I have my dictionary
d = {'A':1, 'B':2, 'C':3}
and my dataframe
df =pd.DataFrame({
"col1": ["A", "B", "C"],
"col2": [1, 2, 3],
"col3": [2, 1, 4] })
I search to compare each value in df with the correspondant value in the dictionary. If it matches the value is kept, otherwise the value is drop.
I try
m = df['col2'] >= d[df['col1']]
df.where(m, df, other = "")
But it get this error code for m: TypeError: 'Series' objects are mutable, thus they cannot be hashed...
Thank you for your help.