I'm tring to run:
import pandas as pd
df_data = pd.DataFrame({'a':[1,20,None,40,50]})
df_data.query('a.isnull()')
and an error happens :
TypeError: 'Series' objects are mutable, thus they cannot be hashed
but:
df_data.a.isnull()
has no error at all, why is this happening? can you help me to figure out why?
Use python engine, or use a np.array with the default npexpr engine.
df_data.query('a.isnull()', engine='python')
or
df_data.query('a.isnull().values')
(Not quite sure why numexpr can't handle a pd.Series though)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With