Skip to content
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

crosstab dropna=False breaks columns.names #12133

Closed
Winand opened this issue Jan 25, 2016 · 2 comments
Closed

crosstab dropna=False breaks columns.names #12133

Winand opened this issue Jan 25, 2016 · 2 comments
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Milestone

Comments

@Winand
Copy link
Contributor

Winand commented Jan 25, 2016

Specifying dropna=False drops column level names:

import pandas as pd
df = pd.DataFrame({"Col1": [23], "Col2": [45]})
names1 = pd.crosstab(df["Col1"], df["Col2"]).columns.names
names2 = pd.crosstab(df["Col1"], df["Col2"], dropna=False).columns.names
print(names1, names2)
>>>['Col2'] [None]

P.S. At first i thought dropna=False will help to count NaN values, though it seems that fillna is needed. So i don't understand, why this parameter is needed at all. If entire column is NaN then we'll get KeyError: '__dummy__' anyway.

pandas: 0.17.1

@jreback
Copy link
Contributor

jreback commented Jan 25, 2016

xref #10291

@jreback jreback added Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode Difficulty Novice labels Jan 25, 2016
@jreback jreback added this to the Next Major Release milestone Jan 25, 2016
@jreback jreback modified the milestones: 0.18.0, Next Major Release, 0.18.1 Feb 11, 2016
@Winand
Copy link
Contributor Author

Winand commented Feb 15, 2016

fix: #12327

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
2 participants