diff --git a/doc/source/user_guide/reshaping.rst b/doc/source/user_guide/reshaping.rst index 7e890962d8da1..c476e33b8ddde 100644 --- a/doc/source/user_guide/reshaping.rst +++ b/doc/source/user_guide/reshaping.rst @@ -471,9 +471,8 @@ If ``crosstab`` receives only two Series, it will provide a frequency table. pd.crosstab(df['A'], df['B']) -Any input passed containing ``Categorical`` data will have **all** of its -categories included in the cross-tabulation, even if the actual data does -not contain any instances of a particular category. +``crosstab`` can also be implemented +to ``Categorical`` data. .. ipython:: python @@ -481,6 +480,15 @@ not contain any instances of a particular category. bar = pd.Categorical(['d', 'e'], categories=['d', 'e', 'f']) pd.crosstab(foo, bar) +If you want to include **all** of data categories even if the actual data does +not contain any instances of a particular category, you should set ``dropna=False``. + +For example: + +.. ipython:: python + + pd.crosstab(foo, bar, dropna=False) + Normalization ~~~~~~~~~~~~~