Crosstab Preserves Dtypes release note · Issue #24789 · pandas-dev/pandas (original) (raw)
The note at http://pandas.pydata.org/pandas-docs/version/0.24.0rc1/whatsnew/v0.24.0.html#crosstab-preserves-dtypes seems incorrect (it's a code block instead of an ipython block, but after making that change and running it).
On master, I get the same output as 0.23.4
0.23.4
In [1]: import pandas as pd; import numpy as np
In [2]: df = pd.DataFrame({'a': [1, 2, 2, 2, 2], ...: 'b': [3, 3, 4, 4, 4], ...: 'c': [1, 1, np.nan, 1, 1]}) ...: ...: pd.crosstab(df.a, df.b, normalize='columns') ...: Out[2]: b 3 4 a 1 0.5 0.0 2 0.5 1.0
master
In [98]: df = pd.DataFrame({'a': [1, 2, 2, 2, 2], ....: 'b': [3, 3, 4, 4, 4], ....: 'c': [1, 1, np.nan, 1, 1]}) ....:
In [99]: pd.crosstab(df.a, df.b, normalize='columns')
-- End pasted text --
Out[4]: b 3 4 a 1 0.5 0.0 2 0.5 1.0
@jbrockmendel this came from #22019. Do you know if the note is obsolete, or has there been a regression?