Skip to content

Commit 9dd31c3

Browse files
committed
clean-ups
1 parent 15870f5 commit 9dd31c3

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

doc/source/user_guide/advanced.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ MultiIndex / advanced indexing
77
******************************
88

99
This section covers :ref:`indexing with a MultiIndex <advanced.hierarchical>`
10-
and :ref:`other advanced indexing features <indexing.index_types>`.
10+
and :ref:`other advanced indexing features <advanced.index_types>`.
1111

1212
See the :ref:`Indexing and Selecting Data <indexing>` for general indexing documentation.
1313

@@ -738,7 +738,7 @@ faster than fancy indexing.
738738
%timeit ser.iloc[indexer]
739739
%timeit ser.take(indexer)
740740
741-
.. _indexing.index_types:
741+
.. _advanced.index_types:
742742

743743
Index types
744744
-----------
@@ -749,7 +749,7 @@ and documentation about ``TimedeltaIndex`` is found :ref:`here <timedeltas.index
749749

750750
In the following sub-sections we will highlight some other index types.
751751

752-
.. _indexing.categoricalindex:
752+
.. _advanced.categoricalindex:
753753

754754
CategoricalIndex
755755
~~~~~~~~~~~~~~~~
@@ -846,7 +846,7 @@ values **not** in the categories, similarly to how you can reindex **any** panda
846846
In [1]: pd.concat([df4, df5])
847847
TypeError: categories must match existing categories when appending
848848
849-
.. _indexing.rangeindex:
849+
.. _advanced.rangeindex:
850850

851851
Int64Index and RangeIndex
852852
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -855,7 +855,7 @@ Int64Index and RangeIndex
855855

856856
In pandas 2.0, :class:`NumericIndex` will become the default index type for numeric types
857857
instead of ``Int64Index``, ``Float64Index`` and ``UInt64Index`` and those index types
858-
will be removed. See :ref:`here <indexing.numericindex>` for more.
858+
will be removed. See :ref:`here <advanced.numericindex>` for more.
859859
``RangeIndex`` however, will not be removed, as it represents an optimized version of an integer index.
860860

861861
:class:`Int64Index` is a fundamental basic index in pandas. This is an immutable array
@@ -864,7 +864,7 @@ implementing an ordered, sliceable set.
864864
:class:`RangeIndex` is a sub-class of ``Int64Index`` that provides the default index for all ``NDFrame`` objects.
865865
``RangeIndex`` is an optimized version of ``Int64Index`` that can represent a monotonic ordered set. These are analogous to Python `range types <https://docs.python.org/3/library/stdtypes.html#typesseq-range>`__.
866866

867-
.. _indexing.float64index:
867+
.. _advanced.float64index:
868868

869869
Float64Index
870870
~~~~~~~~~~~~
@@ -873,7 +873,7 @@ Float64Index
873873

874874
In pandas 2.0, :class:`NumericIndex` will become the default index type for numeric types
875875
instead of ``Int64Index``, ``Float64Index`` and ``UInt64Index`` and those index types
876-
will be removed. See :ref:`here <indexing.numericindex>` for more.
876+
will be removed. See :ref:`here <advanced.numericindex>` for more.
877877
``RangeIndex`` however, will not be removed, as it represents an optimized version of an integer index.
878878

879879
By default a :class:`Float64Index` will be automatically created when passing floating, or mixed-integer-floating values in index creation.
@@ -971,7 +971,7 @@ If you need integer based selection, you should use ``iloc``:
971971
dfir.iloc[0:5]
972972
973973
974-
.. _indexing.numericindex:
974+
.. _advanced.numericindex:
975975

976976
NumericIndex
977977
~~~~~~~~~~~~
@@ -982,16 +982,16 @@ NumericIndex
982982

983983
In pandas 2.0, :class:`NumericIndex` will become the default index type for numeric types
984984
instead of ``Int64Index``, ``Float64Index`` and ``UInt64Index`` and those index types
985-
will be removed. See :ref:`here <indexing.numericindex>` for more.
985+
will be removed.
986986
``RangeIndex`` however, will not be removed, as it represents an optimized version of an integer index.
987987

988988
:class:`NumericIndex` is an index type that can hold data of any numpy int/uint/float dtype. For example:
989989

990990
.. ipython:: python
991991
992-
index = pd.NumericIndex([1, 2, 4, 5], dtype="int8")
993-
index
994-
ser = pd.Series(range(4), index=index)
992+
idx = pd.NumericIndex([1, 2, 4, 5], dtype="int8")
993+
idx
994+
ser = pd.Series(range(4), index=idx)
995995
ser
996996
997997
``NumericIndex`` works the same way as the existing ``Int64Index``, ``Float64Index`` and

doc/source/user_guide/categorical.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ Categorical index
11411141
``CategoricalIndex`` is a type of index that is useful for supporting
11421142
indexing with duplicates. This is a container around a ``Categorical``
11431143
and allows efficient indexing and storage of an index with a large number of duplicated elements.
1144-
See the :ref:`advanced indexing docs <indexing.categoricalindex>` for a more detailed
1144+
See the :ref:`advanced indexing docs <advanced.categoricalindex>` for a more detailed
11451145
explanation.
11461146

11471147
Setting the index will create a ``CategoricalIndex``:

doc/source/whatsnew/v0.16.1.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ values NOT in the categories, similarly to how you can reindex ANY pandas index.
168168
ordered=False, name='B',
169169
dtype='category')
170170
171-
See the :ref:`documentation <indexing.categoricalindex>` for more. (:issue:`7629`, :issue:`10038`, :issue:`10039`)
171+
See the :ref:`documentation <advanced.categoricalindex>` for more. (:issue:`7629`, :issue:`10038`, :issue:`10039`)
172172

173173
.. _whatsnew_0161.enhancements.sample:
174174

doc/source/whatsnew/v1.4.0.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ Enhancements
2020
More flexible numeric dtypes for indexes
2121
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2222

23-
Until now, it has only been possible to create numeric indexes with int64/float64/uint64 dtypes,
24-
but not with lower bit sizes (int32, int8, uint32, uint8 etc). It is now possible to create
25-
an index of any numpy dtype using the new :class:`NumericIndex` (:issue:`41153`):
23+
Until now, it has only been possible to create numeric indexes with int64/float64/uint64 dtypes.
24+
It is now possible to create an index of any numpy int/uint/float dtype using the new :class:`NumericIndex` index type (:issue:`41153`):
2625

2726
.. ipython:: python
2827
@@ -32,7 +31,7 @@ an index of any numpy dtype using the new :class:`NumericIndex` (:issue:`41153`)
3231
3332
In order to maintain backwards compatibility, calls to the base :class:`Index` will in
3433
pandas 1.x. return :class:`Int64Index`, :class:`UInt64Index` and :class:`Float64Index`.
35-
For example, notice that the code below returns an ``Int64Index`` with dtype ``int64``:
34+
For example, the code below returns an ``Int64Index`` with dtype ``int64``:
3635

3736
.. code-block:: ipython
3837
@@ -42,7 +41,8 @@ For example, notice that the code below returns an ``Int64Index`` with dtype ``i
4241
For the duration of Pandas 1.x, in order to maintain backwards compatibility, all
4342
operations that until now have returned :class:`Int64Index`, :class:`UInt64Index` and
4443
:class:`Float64Index` will continue to so. This means, that in order to use
45-
``NumericIndex``, you will have to call it explicitly. For example:
44+
``NumericIndex``, you will have to call ``NumericIndex`` explicitly. For example the below series
45+
will have an ``Int64Index``:
4646

4747
.. code-block:: ipython
4848
@@ -52,16 +52,16 @@ operations that until now have returned :class:`Int64Index`, :class:`UInt64Index
5252
5353
Instead if you want to use a ``NumericIndex``, you should do:
5454

55-
.. code-block:: ipython
55+
.. ipython:: python
5656
57-
In [2]: ser = pd.Series([1, 2, 3], index=pd.NumericIndex([1, 2, 3], dtype="int8"))
58-
In [3]: ser.index
59-
NumericIndex([1, 2, 3], dtype='int8')
57+
idx = pd.NumericIndex([1, 2, 3], dtype="int8"))
58+
ser = pd.Series([1, 2, 3], index=idx)
59+
ser.index
6060
6161
In Pandas 2.0, :class:`NumericIndex` will become the default numeric index type and
6262
``Int64Index``, ``UInt64Index`` and ``Float64Index`` will be removed.
6363

64-
See :ref:`here <indexing.numericindex>` for more.
64+
See :ref:`here <advanced.numericindex>` for more.
6565

6666
.. _whatsnew_140.enhancements.enhancement2:
6767

0 commit comments

Comments
 (0)