-
-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
ExtensionDtype is missing hasobject #26531
Comments
Is this different from .kind being ‘O’? |
To my understanding the difference is that |
One question is: what should this return for extension arrays/dtypes that store data "natively" but box into python objects (eg when converting to a numpy array) ? |
For us, the reason why we check I think that probably for our own use the |
How does |
They are. Sadly, that is a false positive. Ideally, Python strings would have their own dtype and that would make our life much easier. So we recurse and then discover it is a string. |
FWIW PeriodDtype.kind is "O". My gut here is that hasobject is little-used and adding it is more likely to introduce problems than fix them. |
Looks like there not much support to add this attribute from the core team so closing |
Problem description
For better compatibility with numpy dtypes,
hasobject
could be added toExtensionDtype
. We use it to determine if columns contain Python objects or not, but it does not work with sparse column types which are extendingExtensionDtype
.Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.7.final.0
python-bits: 64
OS: Linux
OS-release: 4.18.0-20-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.25.0.dev0+610.gd2beaf3c8
pytest: None
pip: 18.1
setuptools: 40.7.1
Cython: 0.29.7
numpy: 1.15.4
scipy: 1.2.0
pyarrow: 0.13.0
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.5
pytz: 2018.9
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: