BUG: 'Series' objects are mutable, thus they cannot be hashed
See original GitHub issue-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
# Your code here
df = pd.DataFrame({"id":[0, 1, 2], "name":["a", None, None]})
df.query("name.isnull()")
# output:
TypeError: 'Series' objects are mutable, thus they cannot be hashed
Problem description
i’m so sad about this error, cause i do this ‘query’ method a lot of times. But today, this error happend suddenly, i really don’t know what happend with my mac. i just installed mars library which relative with pandas, and nothing else. please help me for this problem, so appreciate!!
Expected Output
id name 1 1 None 2 2 None
Output of pd.show_versions()
INSTALLED VERSIONS
commit : None python : 3.7.6.final.0 python-bits : 64 OS : Darwin OS-release : 19.4.0 machine : x86_64 processor : i386 byteorder : little LC_ALL : None LANG : zh_CN.UTF-8 LOCALE : zh_CN.UTF-8
pandas : 1.0.3 numpy : 1.18.1 pytz : 2019.3 dateutil : 2.8.1 pip : 20.1 setuptools : 46.1.3 Cython : None pytest : 5.0.1 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.5.0 html5lib : None pymysql : 0.9.3 psycopg2 : None jinja2 : 2.10.1 IPython : 7.13.0 pandas_datareader: None bs4 : None bottleneck : None fastparquet : None gcsfs : None lxml.etree : 4.5.0 matplotlib : 3.1.2 numexpr : 2.7.1 odfpy : None openpyxl : 3.0.0 pandas_gbq : None pyarrow : 0.17.0 pytables : None pytest : 5.0.1 pyxlsb : None s3fs : None scipy : 1.4.1 sqlalchemy : 1.3.13 tables : None tabulate : 0.8.7 xarray : None xlrd : 1.2.0 xlwt : None xlsxwriter : None numba : 0.48.0
[TypeError: ‘Series’ objects are mutable, thus they cannot be hashed]
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:13 (5 by maintainers)

Top Related StackOverflow Question
For the poeple wondering why this bug appears for them and not for others (or vice versa):
If you do not have the
numexprpackage installed, then python will be automatically used as engine. Thus, you do not need to specifyengine='python'in the query method.Consequently, one quick fix would be to uninstall the
numexprpackage. This may introduce other issues for you but it worked for me as I didn’t really usenumexprfor anything.Is there any update on fixing this? Running queries on text data is a very common use-case.
For my case, I want to make a
containsquery and got this problem immediately. Found out that one needs to specify the NaN handling inside the query as well, otherwise the python engine complains about it. E.g. for a table containing NaNs the two commands below should have the same output –