Skip to content

DOC: small fixes categorical docs #7917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/source/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1574,8 +1574,8 @@ dtypes:
'float64': np.arange(4.0, 7.0),
'bool1': [True, False, True],
'bool2': [False, True, False],
'dates': pd.date_range('now', periods=3).values}),
'category': pd.Categorical(list("ABC))
'dates': pd.date_range('now', periods=3).values,
'category': pd.Categorical(list("ABC"))})
df['tdeltas'] = df.dates.diff()
df['uint64'] = np.arange(3, 6).astype('u8')
df['other_dates'] = pd.date_range('20130101', periods=3).values
Expand Down
6 changes: 3 additions & 3 deletions doc/source/categorical.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@ Appending levels can be done by assigning a levels list longer than the current
Adding levels in other positions can be done with ``.reorder_levels(<levels_including_new>)``.

Removing a level is also possible, but only the last level(s) can be removed by assigning a
shorter list than current levels. Values which are omitted are replaced by `np.nan`.
shorter list than current levels. Values which are omitted are replaced by ``np.nan``.

.. ipython:: python

s.levels = [1,2]
s.cat.levels = [1,2]
s

.. note::
Expand Down Expand Up @@ -322,7 +322,7 @@ old levels:
.. ipython:: python

s3 = pd.Series(pd.Categorical(["a","b","d"]))
s3.cat.reorder_levels(["a","b","c",d"])
s3.cat.reorder_levels(["a","b","c","d"])
s3


Expand Down