Skip to content

Commit a89dee5

Browse files
committed
update docs
1 parent 9a76ad6 commit a89dee5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

doc/source/user_guide/categorical.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ By passing a :class:`pandas.Categorical` object to a ``Series`` or assigning it
7777
.. ipython:: python
7878
7979
raw_cat = pd.Categorical(
80-
["a", "b", "c", "a"], categories=["b", "c", "d"], ordered=False
80+
[None, "b", "c", "a"], categories=["b", "c", "d"], ordered=False
8181
)
8282
s = pd.Series(raw_cat)
8383
s

pandas/core/arrays/categorical.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ def categories(self) -> Index:
821821
>>> ser.cat.categories
822822
Index(['a', 'b', 'c'], dtype='str')
823823
824-
>>> raw_cat = pd.Categorical(["a", "b", "c", "a"], categories=["b", "c", "d"])
824+
>>> raw_cat = pd.Categorical([None, "b", "c", "a"], categories=["b", "c", "d"])
825825
>>> ser = pd.Series(raw_cat)
826826
>>> ser.cat.categories
827827
Index(['b', 'c', 'd'], dtype='str')
@@ -1129,7 +1129,7 @@ def set_categories(
11291129
For :class:`pandas.Series`:
11301130
11311131
>>> raw_cat = pd.Categorical(
1132-
... ["a", "b", "c", "A"], categories=["a", "b", "c"], ordered=True
1132+
... ["a", "b", "c", None], categories=["a", "b", "c"], ordered=True
11331133
... )
11341134
>>> ser = pd.Series(raw_cat)
11351135
>>> ser

0 commit comments

Comments
 (0)