Pandas version checks
- [X] I have checked that this issue has not already been reported.
- [X] I have confirmed this bug exists on the latest version of pandas.
- [X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
pd.Series([b"hi"], dtype="V2")
Issue Description
I assume you mean what numpy calls “structured dtype” when you say “compound dtype” here:
https://github.com/pandas-dev/pandas/blob/ca429943c70cee2077941f052281b92afc0c2054/pandas/core/generic.py#L492-L497
Unless you mean something totally different, that code is wrong. There’s other applications for void
dtypes than structured arrays. void
means “we don’t validate bit patterns here”, i.e. it corresponds to builtins.bytes
(unlike S
, a
, which according to numpy are “zero terminated byte strings (not recommended)” so those codes aren’t a valid alternative).
If I’m right about your intention and you want to prevent structured arrays / recarrays, you should instead check if getattr(dtype, "fields", None) is not None
.
Expected Behavior
Being able to create an ExtensionDtype with kind = 'V...'
and sticking it into a Series.
Installed Versions
Comment From: flying-sheep
This is still an issue.
Who implemented that check? Can that person please explain what it’s for so we can fix it?
Comment From: flying-sheep
I have a lovely ExtensionDType that I’d like to use, but it’s blocked on this issue for 11 months now.
Could someone please take a look?
https://gist.github.com/flying-sheep/99f2ceafdc494f97424222611b4f9474
Comment From: flying-sheep
Hello?
Comment From: flying-sheep
Anyone home?
Comment From: ilan-gold
@shoyer Having a UUID extension array would be amazing for anndata, specifically the xarray integration.
Since we have to load coords
in xarray, one way around that (that I'm pursuing) is loading the true index elsewhere and using an in-memory range index so that people have good first-load times. The issue, though, is that once you index a range indexer, you end up with an integer index after indexing into it, and we disallow this in AnnData to prevent confusion i.e., how iloc
is its own method. So having a UUID index instead would be great - it would also help us avoid things like stacking two range indices.
I think either Phil or I can implement a fix, but the explanation would be helpful if it's solvable.
Comment From: ilan-gold
I have also run into "distinguishing between void and structured" in zarr so understanding that difference and how to check for it (at least from you) would be amazing for my own knowledge.