You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
df = pd.DataFrame(np.zeros(3, dtype))
df.columns = ind
as you expected.
So knowing this, the output you see is correct, as the reindex will not find matching column names and return an empty dataframe.
There are some related issues about this, and some discussions on changing this (but the question is also whether it is worth the breaking change).
I previously posted this as a question (not knowing it was a bug) here: http://stackoverflow.com/questions/37732403/pandas-dataframe-from-multiindex-and-numpy-structured-array-recarray
First I create a two-level MultiIndex:
I can use it like this:
Which gives:
But now I'm trying to do this:
But that gives me an empty DataFrame!
I expected it to do the same thing as this:
Which is:
INSTALLED VERSIONS
commit: None
python: 2.7.10.final.0
python-bits: 64
OS: Linux
OS-release: 3.13.0-86-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.18.0
pip: 8.1.1
setuptools: 20.7.0
numpy: 1.10.0
scipy: 0.16.0
statsmodels: 0.6.1
IPython: 3.2.1
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.4
tables: 3.2.2
numexpr: 2.5.2
matplotlib: 1.4.3
The text was updated successfully, but these errors were encountered: