Skip to content

Commit ffffa5c

Browse files
testvinderjreback
authored andcommitted
Reapply all patches by @testvinder against master (#21413)
1 parent e77dc7e commit ffffa5c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pandas/core/reshape/pivot.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,18 @@ def crosstab(index, columns, values=None, rownames=None, colnames=None,
446446
>>> foo = pd.Categorical(['a', 'b'], categories=['a', 'b', 'c'])
447447
>>> bar = pd.Categorical(['d', 'e'], categories=['d', 'e', 'f'])
448448
>>> crosstab(foo, bar) # 'c' and 'f' are not represented in the data,
449-
... # but they still will be counted in the output
449+
# and will not be shown in the output because
450+
# dropna is True by default. Set 'dropna=False'
451+
# to preserve categories with no data
452+
... # doctest: +SKIP
453+
col_0 d e
454+
row_0
455+
a 1 0
456+
b 0 1
457+
458+
>>> crosstab(foo, bar, dropna=False) # 'c' and 'f' are not represented
459+
# in the data, but they still will be counted
460+
# and shown in the output
450461
... # doctest: +SKIP
451462
col_0 d e f
452463
row_0

0 commit comments

Comments
 (0)