Skip to content

BUG: pd.Series.apply / pd.Series.map outputs to numpy dtype for a double[pyarrow] input #53527

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
VaasuDevanS opened this issue Jun 5, 2023 · 1 comment
Closed
3 tasks done
Labels
Apply Apply, Aggregate, Transform, Map Arrow pyarrow functionality Bug Dtype Conversions Unexpected or buggy dtype conversions

Comments

@VaasuDevanS
Copy link

VaasuDevanS commented Jun 5, 2023

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
s = pd.Series([10, 20, 30], dtype='double[pyarrow]')
s.apply(lambda x: x + 1)
s.map(lambda x: x + 1)

Issue Description

Using the series .apply() or .map() methods, the return dtype is float64

>>> print(s)
0    10.0
1    20.0
2    30.0
dtype: double[pyarrow]
>>> print(s.apply(lambda x: x + 1))
0    11.0
1    21.0
2    31.0
dtype: float64
>>> print(s.map(lambda x: x + 1))
0    11.0
1    21.0
2    31.0
dtype: float64

Expected Behavior

The return dtype is expected to be the same as the input. In this case it's double[pyarrow]

Installed Versions

INSTALLED VERSIONS

commit : 965ceca
python : 3.10.11.final.0
python-bits : 64
OS : Linux
OS-release : 5.15.107+
Version : #1 SMP Sat Apr 29 09:15:28 UTC 2023
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 2.0.2
numpy : 1.22.4
pytz : 2022.7.1
dateutil : 2.8.2
setuptools : 67.7.2
pip : 23.1.2
Cython : 0.29.34
pytest : 7.2.2
hypothesis : None
sphinx : 3.5.4
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.2
html5lib : 1.1
pymysql : None
psycopg2 : 2.9.6
jinja2 : 3.1.2
IPython : 7.34.0
pandas_datareader: 0.10.0
bs4 : 4.11.2
bottleneck : None
brotli : None
fastparquet : None
fsspec : 2023.4.0
gcsfs : None
matplotlib : 3.7.1
numba : 0.56.4
numexpr : 2.8.4
odfpy : None
openpyxl : 3.0.10
pandas_gbq : 0.17.9
pyarrow : 9.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.10.1
snappy : None
sqlalchemy : 2.0.10
tables : 3.8.0
tabulate : 0.8.10
xarray : 2022.12.0
xlrd : 2.0.1
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None

@VaasuDevanS VaasuDevanS added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 5, 2023
@VaasuDevanS VaasuDevanS changed the title BUG: pd.Series.apply / pd.Series.map corresponds to numpy dtype for a double[pyarrow] BUG: pd.Series.apply / pd.Series.map outputs to numpy dtype for a double[pyarrow] input Jun 5, 2023
@lithomas1 lithomas1 added Apply Apply, Aggregate, Transform, Map Arrow pyarrow functionality Dtype Conversions Unexpected or buggy dtype conversions and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 6, 2023
@mroeschke
Copy link
Member

Thanks for the report but this is essentially a duplicate of #51991 so closing in favor of that issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apply Apply, Aggregate, Transform, Map Arrow pyarrow functionality Bug Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

No branches or pull requests

3 participants