You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pd.DataFrame.query function works weirdly based on this example. I'm trying to use more method chaining in pandas, and when I tried what is shown in the example I've come up with the behavior (explained in the example).
It seems that if a column is not considered as bool first, the .query("not column") throws a KeyError, while .query("column") doesn't
Expected Behavior
I am unsure that this is a bug, or this behavior is exepcted.
Installed Versions
INSTALLED VERSIONS
commit : bb1f651
python : 3.9.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-1063-aws
Version : #66~18.04.1-Ubuntu SMP Thu Jan 13 19:45:37 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
The
pd.DataFrame.query
function works weirdly based on this example. I'm trying to use more method chaining in pandas, and when I tried what is shown in the example I've come up with the behavior (explained in the example).It seems that if a column is not considered as bool first, the
.query("not column")
throws a KeyError, while.query("column")
doesn'tExpected Behavior
I am unsure that this is a bug, or this behavior is exepcted.
Installed Versions
INSTALLED VERSIONS
commit : bb1f651
python : 3.9.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-1063-aws
Version : #66~18.04.1-Ubuntu SMP Thu Jan 13 19:45:37 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.4.0
numpy : 1.22.2
pytz : 2021.3
dateutil : 2.8.2
pip : 22.0.3
setuptools : 59.8.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : 1.0.2
psycopg2 : None
jinja2 : 3.0.3
IPython : 7.31.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : 2022.01.0
gcsfs : None
matplotlib : 3.5.1
numba : None
numexpr : None
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.0
sqlalchemy : 1.4.31
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
xlwt : None
zstandard : None
None
The text was updated successfully, but these errors were encountered: