-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: documented usage of of str.split(...).str.get
fails on dtype large_string[pyarrow]
#61431
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
Thanks for the report! Agreed on the inconsistency here. print(pd.Series(["abc"], dtype="large_string[pyarrow]").str.split("b"))
# 0 ['a' 'c']
# dtype: list<item: large_string>[pyarrow]
print(pd.Series(["abc"], dtype="string[pyarrow]").str.split("b"))
# 0 [a, c]
# dtype: object The behavior on While the current behavior of returning ArrowExtensionArray list dtype on cc @WillAyd @mroeschke for any thoughts as well. |
This is a general issue that I was hoping the logical type system proposal would clarify, as it gets pretty tough to cherry pick different code paths for different data types. I think the best solution would return a list data type as a result of this operation. It is more inline with the intent of the user code, and more performant |
@WillAyd - which operation? |
str.split |
On both |
👍 |
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 return dtype of
split
is very different when acting onlarge_string
(results in pyarrow list) andstring
(results in object).Interestingly, using the
list
accessor works only onlarge_string
dtypebut not on
string
dtypeFrom a use perspective this is unfortunate, as I have to know the underlying dtype in order to choose the correct accessor (or cast).
Expected Behavior
Should work similar to
since it is documented behavior
pandas/doc/source/user_guide/text.rst
Line 229 in f496acf
Installed Versions
INSTALLED VERSIONS
commit : f496acf
python : 3.13.2
python-bits : 64
OS : Darwin
OS-release : 24.4.0
Version : Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:47 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6000
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 3.0.0.dev0+2100.gf496acffcc
numpy : 2.2.5
dateutil : 2.9.0.post0
pip : 25.1
Cython : 3.0.11
sphinx : None
IPython : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : None
lxml.etree : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
psycopg2 : None
pymysql : None
pyarrow : 20.0.0
pyreadstat : None
pytest : None
python-calamine : None
pytz : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2025.2
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: