Description
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
pd.Series([b"hi"], dtype="V2")
Issue Description
I assume you mean what numpy calls “structured dtype” when you say “compound dtype” here:
Lines 492 to 497 in ca42994
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
INSTALLED VERSIONS
commit : 0f43794
python : 3.11.3.final.0
python-bits : 64
OS : Linux
OS-release : 6.4.12-zen1-1-zen
Version : #1 ZEN SMP PREEMPT_DYNAMIC Thu, 24 Aug 2023 00:37:46 +0000
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : de_DE.UTF-8
LOCALE : de_DE.UTF-8
pandas : 2.0.3
numpy : 1.25.2
pytz : 2023.3
dateutil : 2.8.2
setuptools : 68.0.0
pip : 23.2.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 8.14.0
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 13.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.11.2
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None