-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Creating DataFrame throws: data type "bytes512" not understood #20734
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
Comments
I think this issue is back one layer in NumPy: np.dtype('float') == np.dtype('float').name
True
np.dtype('S64') == np.dtype('S64').name
*** TypeError: data type "bytes512" not understood Not an expert on dtypes so will see if others chime in, but I have a feeling this will need to be opened as an issue with that project instead of here |
See numpy/numpy#5329 |
The issue @jschendel links to is about that numpy does not compare to dtypes it does not know about (because |
For sure it's a little bit of a gray area to the issue described, but reading through the comments it doesn't seem like NumPy wants to make any guarantees about str comps. This one is certainly more compelling of an argument to support than a comp to an arbitrary string so I suppose we could open the issue there and see if it gains more traction than the linked issue (happy to open that). cc @jreback for any input |
@jschendel I'd think that that NumPy bug is relevant but, in this case, not the same bug because Of course, I'd also argue that the expample given in that issue ( Such a design change, had it been effected, would change the story of this issue. We would now be discussion why my DataFrame code was throwing warnings saying that Finally: why is |
this is a numpy issue (if that) and not solvable in pandas |
actually we should do this patch:
though its still buggy. string types like these should be converted to |
Looks like we correctly coerce to object now. Guess this could use a test
|
Code Sample, a copy-pastable example if possible
Problem description
The code, above, which is attempting to create an empty
pandas.DataFrame
with an index and four typed columns yields the following error:Why?
Changing the order of the columns works just fine:
In fact, it seems that any
Series
added after the twoS64
series throws an error: I tried with bothnp.float
andnp.bool
.Expected Output
I would expect that it isn't important which order the Series are added or, if it actually is important, perhaps a better error message.
I tried with an older version of Python 3.6, NumPy and Pandas and then updated, thinking this was just a bug. The latest version I tested was CPython 3.6.5, NumPy 1.14.2, Pandas 0.22.0.
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 26 Stepping 5, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.22.0
pytest: None
pip: 9.0.3
setuptools: 39.0.1
Cython: None
numpy: 1.14.2
scipy: 1.0.1
pyarrow: None
xarray: None
IPython: 6.3.1
sphinx: None
patsy: None
dateutil: 2.7.2
pytz: 2018.4
blosc: None
bottleneck: None
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.6.0
html5lib: 0.9999999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: