A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/12133 below:

crosstab dropna=False breaks columns.names · Issue #12133 · pandas-dev/pandas · GitHub

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4