-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: python crashes on filtering with .loc
on boolean Series with dtype_backend=pyarrow
on some dataframes.
#52059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
.loc
on boolean Series with dtype_backend=pyarrow
on some dataframes.
I have found what I believe is the same bug. Tested it in 2.0 RC1 and in master branch Using a single string column csv file bug.csv.gz import pandas as pd
df = pd.read_csv("bug.csv", dtype={"data_validity_comment": "string[pyarrow]"})
outside = df[df["data_validity_comment"] == "Outside typical range"]
# python crashes Dataframe shape is (145000, 1). It stops crashing if I cut it exactly at 143116. import pandas as pd
df = pd.read_csv("bug.csv", dtype={"data_validity_comment": "string[pyarrow]"})
df = df[0:143116].copy()
outside = df[df["data_validity_comment"] == "Outside typical range"] This is also the simpler example I could come with... |
cc @mroeschke Looks like this is coming from The following reproduces for me:
|
Calling |
Unfortunately I never used |
I opened apache/arrow#34634 upstream in the arrow repo. |
I also experienced this, pyarrow backed series contains
|
@char101 |
@pstorozenko Thanks, I understand. The reason I thought it was a bug is that the first Edit: Adding |
This bug is related to pandas 2.0. On 1.5.3 (with numpy as dtype backend) everything works.
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
Using parquet from wiki100.zip.
Issue Description
After running such script I get
Expected Behavior
I should get the result of this query:
Installed Versions
INSTALLED VERSIONS
commit : 23c3dc2
python : 3.10.9.final.0
python-bits : 64
OS : Linux
OS-release : 5.19.0-35-generic
Version : #36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.1.0.dev0+246.g23c3dc2c37
numpy : 1.25.0.dev0+918.g28bce82c8
pytz : 2022.7.1
dateutil : 2.8.2
setuptools : 65.6.3
pip : 23.0.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 11.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2022.7
qtpy : None
pyqt5 : None
None
Context
The file is a subset subset of wiki clickstream data.
This code works well if I don't set
dtype_backend="pyarrow"
.Tested in both 2.0.0rc1 and on nightly.
The operation
wiki['curr'] == "Warsaw"
executes correctly so it's an issue with filtering on boolean array.Sorry for not providing a simpler example, as all those handcrafted worked all the time.
The text was updated successfully, but these errors were encountered: