In the case of my python dictionary "Eigenkapitalquote":

'''
{'html_string_0': '2021.0; 49.91', 'html_string_1': '2020.0; N/A', 'html_string_2': '2020.0; N/A', 'html_string_3': '2019.0; N/A', 'html_string_4': '2018.0; 51.18', 'html_string_5': 'None; N/A', 'html_string_6': '2017.0; 44.73', 'html_string_7': '2016.0; 0.00', 'html_string_8': '2015.0; 0.00', 'html_string_9': '2014.0; 175.00', 'html_string_10': '2013.0; 0.00', 'html_string_11': 'None; 55.16', 'html_string_12': '2011.0; 51.76', 'html_string_13': '2010.0; 55.73', 'html_string_14': 'None; 44.97', 'html_string_15': 'None; 39.61', 'html_string_16': 'None; 32.44', 'html_string_17': 'None; 37.04', 'html_string_18': 'None; N/A', 'html_string_19': 'None; N/A'}
'''

I have the folowing code:

'''
def sort_and_filter_v2(Eigenkapitalquote):
    years = []
    values = []

    for key, value in Eigenkapitalquote.items():
        year_str, value_str = value.split('; ')
        if year_str != 'None':
            year = float(year_str)
        #else:
        #    year = None
        if value_str != 'N/A':
            val = float(value_str)
        #else:
        #    val = None
        years.append(year)
        values.append(val)

    # Sort the data by years
    sorted_data = sorted(zip(years, values), key=lambda x: x[0] if x[0] is not None else float('inf'))
    sorted_years, sorted_values = zip(*sorted_data)

    sorted_years = np.array(sorted_years)
    sorted_values = np.array(sorted_values)

    # Debugging: Print types and values
    print("sorted_years:", sorted_years)
    print("sorted_values:", sorted_values)
    print("Types:", sorted_years.dtype, sorted_values.dtype)

    # Define a small epsilon for float comparison
    epsilon = 1e-10

    # Filter out the pairs where the year is 2010 and the value is 0
    year_condition = np.abs(sorted_years - 2010) < epsilon
    value_condition = np.abs(sorted_values) < epsilon
    print("Year condition:", year_condition)
    print("Value condition:", value_condition)
    filter_mask = ~(year_condition & value_condition)
    print("Filter Mask:", filter_mask)
    filtered_years = sorted_years[filter_mask]
    filtered_values = sorted_values[filter_mask]

    return filtered_years, filtered_values

filtered_years, filtered_values = sort_and_filter_v2(Eigenkapitalquote)

print("----------------------------------------")
print(filtered_years)
print(filtered_values)
'''

that results in:

'''
sorted_years: [2010. 2010. 2010. 2010. 2010. 2010. 2010. 2011. 2013. 2013. 2014. 2015.
 2016. 2017. 2018. 2018. 2019. 2020. 2020. 2021.]
sorted_values: [ 55.73  44.97  39.61  32.44  37.04  37.04  37.04  51.76   0.    55.16
 175.     0.     0.    44.73  51.18  51.18  49.91  49.91  49.91  49.91]
Types: float64 float64
Year condition: [ True  True  True  True  True  True  True False False False False False
 False False False False False False False False]
Value condition: [False False False False False False False False  True False False  True
  True False False False False False False False]
Filter Mask: [ True  True  True  True  True  True  True  True  True  True  True  True
  True  True  True  True  True  True  True  True]
----------------------------------------
[2010. 2010. 2010. 2010. 2010. 2010. 2010. 2011. 2013. 2013. 2014. 2015.
 2016. 2017. 2018. 2018. 2019. 2020. 2020. 2021.]
[ 55.73  44.97  39.61  32.44  37.04  37.04  37.04  51.76   0.    55.16
 175.     0.     0.    44.73  51.18  51.18  49.91  49.91  49.91  49.91]
'''

Why is the masking not working correctly?