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: is_numeric_dtype returns False for numeric ArrowDtypes #50563

Closed
2 of 3 tasks
charlesbluca opened this issue Jan 4, 2023 · 0 comments · Fixed by #50572
Closed
2 of 3 tasks

BUG: is_numeric_dtype returns False for numeric ArrowDtypes #50563

charlesbluca opened this issue Jan 4, 2023 · 0 comments · Fixed by #50572
Labels
Arrow pyarrow functionality Bug

Comments

@charlesbluca
Copy link
Contributor

charlesbluca commented Jan 4, 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
import pyarrow as pa
from pandas.api.types import is_numeric_dtype

# false
is_numeric_dtype(pd.ArrowDtype(pa.int64()))
is_numeric_dtype(pd.ArrowDtype(pa.float64()))
is_numeric_dtype(pd.ArrowDtype(pa.int32()))
is_numeric_dtype(pd.ArrowDtype(pa.float32()))

# true
pd.ArrowDtype(pa.int64())._is_numeric
pd.ArrowDtype(pa.float64())._is_numeric
pd.ArrowDtype(pa.int32())._is_numeric
pd.ArrowDtype(pa.float32())._is_numeric

Issue Description

Passing a numeric ArrowDtype to is_numeric_dtype returns False, even when its _is_numeric attribute is True.

Expected Behavior

I would assume that the return value of is_numeric_dtype would be consistent with the value of _is_numeric for these dtypes.

Installed Versions

INSTALLED VERSIONS

commit : 8dab54d
python : 3.10.8.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-189-generic
Version : #200-Ubuntu SMP Wed Jun 22 19:53:37 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.5.2
numpy : 1.23.5
pytz : 2022.7
dateutil : 2.8.2
setuptools : 65.6.3
pip : 22.3.1
Cython : None
pytest : 7.2.0
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.8.0
pandas_datareader: None
bs4 : None
bottleneck : None
brotli :
fastparquet : 2022.12.0
fsspec : 2022.11.0
gcsfs : None
matplotlib : None
numba : 0.56.4
numexpr : 2.8.3
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 10.0.1
pyreadstat : None
pyxlsb : None
s3fs : 2022.11.0
scipy : 1.10.0
snappy :
sqlalchemy : 1.4.46
tables : 3.7.0
tabulate : None
xarray : 2022.12.0
xlrd : None
xlwt : None
zstandard : None
tzdata : None

@charlesbluca charlesbluca added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 4, 2023
@mroeschke mroeschke added Arrow pyarrow functionality and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants