I am trying to filter a dataframe in pandas with multiple conditions and I keep getting the same error: Cannot perform 'rand_' with a dtyped [float64] array and scalar of type [bool]
I have tried several solutions such as changing the operator (or/and instead of |/&); I have reviewed the parenthesis...
Code:
df= pd.DataFrame(df)
filtered = (((df['a'] == 'str1') |
(df['a'] == 'str2') |
(df['a'] == 'str3') |
(df['a'] == 'str4')) &
(df['b'] >= 13))
df= df[filtered]