Skip to content

Commit daf8761

Browse files
committed
DOC: doc updates for categoricals
1 parent 1ac2dec commit daf8761

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

doc/source/categorical.rst

+9-10
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ the `categories` array.
4747
The categorical data type is useful in the following cases:
4848

4949
* A string variable consisting of only a few different values. Converting such a string
50-
variable to a categorical variable will save some memory, see :ref:`here<categorical.memory>`.
50+
variable to a categorical variable will save some memory, see :ref:`here <categorical.memory>`.
5151
* The lexical order of a variable is not the same as the logical order ("one", "two", "three").
5252
By converting to a categorical and specifying an order on the categories, sorting and
5353
min/max will use the logical order instead of the lexical order.
@@ -611,10 +611,13 @@ available ("missing value") or `np.nan` is a valid category.
611611
pd.isnull(s)
612612
s.fillna("a")
613613
614+
Gotchas
615+
-------
616+
614617
.. _categorical.rfactor:
615618

616619
Differences to R's `factor`
617-
---------------------------
620+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
618621

619622
The following differences to R's factor functions can be observed:
620623

@@ -629,15 +632,11 @@ The following differences to R's factor functions can be observed:
629632
new categorical series will *not* remove unused categories but create a new categorical series
630633
which is equal to the passed in one!
631634

632-
633-
Gotchas
634-
-------
635-
636-
.. _categorical.memory:
637-
638635
Memory Usage
639636
~~~~~~~~~~~~
640637

638+
.. _categorical.memory:
639+
641640
The memory usage of a ``Categorical`` is proportional to the length of the categories times the length of the data. In contrast,
642641
the an ``object`` dtype is a fixed function of the length of the data.
643642

@@ -738,7 +737,7 @@ basic type) and applying along columns will also convert to object.
738737
df.apply(lambda row: type(row["cats"]), axis=1)
739738
df.apply(lambda col: col.dtype, axis=0)
740739
741-
No categorical index
740+
No Categorical Index
742741
~~~~~~~~~~~~~~~~~~~~
743742

744743
There is currently no index of type ``category``, so setting the index to categorical column will
@@ -760,7 +759,7 @@ ordering of the categories:
760759
https://github.com/pydata/pandas/issues/7629)
761760

762761

763-
Side effects
762+
Side Effects
764763
~~~~~~~~~~~~
765764

766765
Constructing a `Series` from a `Categorical` will not copy the input `Categorical`. This

0 commit comments

Comments
 (0)