Skip to content

Commit d50a729

Browse files
committed
Merge pull request #7917 from jorisvandenbossche/docs-categorical-fixes
DOC: small fixes categorical docs
2 parents 3c09ffd + ecf5851 commit d50a729

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

doc/source/basics.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,8 +1574,8 @@ dtypes:
15741574
'float64': np.arange(4.0, 7.0),
15751575
'bool1': [True, False, True],
15761576
'bool2': [False, True, False],
1577-
'dates': pd.date_range('now', periods=3).values}),
1578-
'category': pd.Categorical(list("ABC))
1577+
'dates': pd.date_range('now', periods=3).values,
1578+
'category': pd.Categorical(list("ABC"))})
15791579
df['tdeltas'] = df.dates.diff()
15801580
df['uint64'] = np.arange(3, 6).astype('u8')
15811581
df['other_dates'] = pd.date_range('20130101', periods=3).values

doc/source/categorical.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,11 @@ Appending levels can be done by assigning a levels list longer than the current
228228
Adding levels in other positions can be done with ``.reorder_levels(<levels_including_new>)``.
229229

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

233233
.. ipython:: python
234234
235-
s.levels = [1,2]
235+
s.cat.levels = [1,2]
236236
s
237237
238238
.. note::
@@ -322,7 +322,7 @@ old levels:
322322
.. ipython:: python
323323
324324
s3 = pd.Series(pd.Categorical(["a","b","d"]))
325-
s3.cat.reorder_levels(["a","b","c",d"])
325+
s3.cat.reorder_levels(["a","b","c","d"])
326326
s3
327327
328328

0 commit comments

Comments
 (0)