Skip to content
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

BUG: pyarrow listaccessor does not preserve indexes #58425

Closed
3 tasks done
yganodot opened this issue Apr 25, 2024 · 1 comment · Fixed by #58438
Closed
3 tasks done

BUG: pyarrow listaccessor does not preserve indexes #58425

yganodot opened this issue Apr 25, 2024 · 1 comment · Fixed by #58438
Assignees
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@yganodot
Copy link

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

import pandas as pd
from pandas import ArrowDtype
import pyarrow as pa

pd.options.mode.string_storage = "pyarrow"
og_df = df
df = pd.DataFrame(dict(v=['a', 'b']), index=[1, 3])
df['v'] = df['v'].astype(ArrowDtype(pa.string()))
ser = df['v'].str.split('-')
accessed = ser.list[0]
print('comparing indexes:')
print('original:')
print(df.index)
print('after list accessor:')
print(accessed.index)

print('misc:')
print(df.dtypes)
print('----')
print(ser.dtype)
print('----')
print(accessed.dtype)

Issue Description

after using pyarrow's listaccessor's methods on a pandas series the returned series always has a RangeIndex index regardless of the original series's index.

Expected Behavior

I would have expected the indices to be identical.

Installed Versions

INSTALLED VERSIONS

commit : bdc79c1
python : 3.11.4.final.0
python-bits : 64
OS : Darwin
OS-release : 23.4.0
Version : Darwin Kernel Version 23.4.0: Fri Mar 15 00:11:05 PDT 2024; root:xnu-10063.101.17~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.UTF-8

pandas : 2.2.1
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.9.0.post0
setuptools : 69.1.1
pip : 23.2.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 5.1.0
html5lib : None
pymysql : 1.4.6
psycopg2 : None
jinja2 : 3.1.3
IPython : 8.23.0
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.12.3
bottleneck : None
dataframe-api-compat : None
fastparquet : 2024.2.0
fsspec : 2024.2.0
gcsfs : None
matplotlib : 3.8.3
numba : 0.59.0
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 15.0.0
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : 2024.2.0
scipy : 1.12.0
sqlalchemy : 2.0.27
tables : None
tabulate : 0.9.0
xarray : None
xlrd : None
zstandard : None
tzdata : 2024.1
qtpy : None
pyqt5 : None

@yganodot yganodot added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 25, 2024
@rohanjain101
Copy link
Contributor

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants