-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Dataframe constructor misinterprets columns
argument if nested list is passed in as the data
parameter.
#14467
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
you have several issues.
|
Then why do cases 1 and 2 work? The problem is that the behavior is inconsistent. |
the shapes are correct there |
Case 1 only differs from the "broken" case in that is passes in an |
@jreback I didn't know you could pass a list of lists to represent a MultiIndex (like you would pass to
|
take |
The columns case looks to work on master now. Could use a test
|
@mroeschke I tried with version 1.2.3 on Arch Linux and it worked fine. I'd be happy to add a test like my original example if you point me to where. It was interesting to see your message pop up. Took me a few minutes to figure out what it was about. |
This issue is based on Stack Overflow question http://stackoverflow.com/q/40182072/2988730.
A small, complete example of the issue
The result is
Expected Output
The surprising thing here is that any of the following seem to work just fine:
Supplying a numpy array as
data
:Results in
Reducing the size of the input array to have two columns:
Results in
Omitting the
columns
argument:Results in
Using a single-level list for the
columns
argument:Results in
Output of
pd.show_versions()
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 2.6.32-431.29.2.el6.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.18.1
nose: 1.3.7
pip: 8.1.2
setuptools: 25.1.6
Cython: 0.24.1
numpy: 1.11.1
scipy: 0.18.0
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: 1.4.1
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: None
numexpr: 2.6.1
matplotlib: 1.5.1
openpyxl: 2.3.5
xlrd: None
xlwt: None
xlsxwriter: 0.8.4
lxml: 3.5.0
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: