Skip to content

BUG: string[pyarrow] dtype not loaded from feather #43565

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

Closed
3 tasks done
shulmaneyal opened this issue Sep 14, 2021 · 3 comments
Closed
3 tasks done

BUG: string[pyarrow] dtype not loaded from feather #43565

shulmaneyal opened this issue Sep 14, 2021 · 3 comments
Labels
Arrow pyarrow functionality Bug IO Data IO issues that don't fit into a more specific label Strings String extension data type and string data

Comments

@shulmaneyal
Copy link

shulmaneyal commented Sep 14, 2021

  • 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 master branch of pandas.

Reproducible Example

s = pd.DataFrame({'s':['aaa', 'bbb', 'ccc']})
print(f'Initial df bytes {s.memory_usage(deep=True, index=False).sum()}')
# Initial df bytes 180
s = s.assign(s=s.s.astype('string[pyarrow]'))
print(f'pyarrow string df bytes {s.memory_usage(deep=True, index=False).sum()}')
# pyarrow string df bytes 25
s.to_feather('s.feather')
s = pd.read_feather('s.feather')
print(f'after feather bytes {s.memory_usage(deep=True, index=False).sum()}')
# after feather bytes 180

Issue Description

Loading a df that contains a column of type string[pyarrow] from a feather file loads the column as type string

Expected Behavior

Load the column in its original string[pyarrow] type

Installed Versions

INSTALLED VERSIONS

commit : 5f648bf
python : 3.9.6.final.0
python-bits : 64
OS : Darwin
OS-release : 20.4.0
Version : Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:47 PDT 2021; root:xnu-7195.101.2~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.UTF-8

pandas : 1.3.2
numpy : 1.21.2
pytz : 2021.1
dateutil : 2.8.2
pip : 21.2.4
setuptools : 52.0.0.post20210125
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.1
IPython : 7.27.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : 2021.08.1
fastparquet : None
gcsfs : 2021.08.1
matplotlib : 3.4.3
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 5.0.0
pyxlsb : None
s3fs : None
scipy : 1.7.1
sqlalchemy : 1.4.23
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None

@shulmaneyal shulmaneyal added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 14, 2021
@mzeitlin11
Copy link
Member

Thanks for reporting this @shulmaneyal! I think this falls under a similar category as #42664?

@mzeitlin11 mzeitlin11 added Arrow pyarrow functionality IO Data IO issues that don't fit into a more specific label Strings String extension data type and string data and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 14, 2021
@shulmaneyal
Copy link
Author

shulmaneyal commented Sep 15, 2021

Yes, as suggested I added the below line which solved it
with pd.option_context("string_storage", "pyarrow"):

Should we close the issue?

@mzeitlin11
Copy link
Member

Yeah, let's close it since the same idea is covered under the other issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality Bug IO Data IO issues that don't fit into a more specific label Strings String extension data type and string data
Projects
None yet
Development

No branches or pull requests

2 participants