You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a convenience, you can pass a list of arrays directly into Series or
87
-
DataFrame to construct a MultiIndex automatically:
87
+
DataFrame to construct a ``MultiIndex`` automatically:
88
88
89
89
.. ipython:: python
90
90
@@ -140,7 +140,7 @@ may wish to generate your own ``MultiIndex`` when preparing the data set.
140
140
Reconstructing the level labels
141
141
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142
142
143
-
The method ``get_level_values`` will return a vector of the labels for each
143
+
The method :meth:`~MultiIndex.get_level_values` will return a vector of the labels for each
144
144
location at a particular level:
145
145
146
146
.. ipython:: python
@@ -183,7 +183,7 @@ For example:
183
183
184
184
This is done to avoid a recomputation of the levels in order to make slicing
185
185
highly performant. If you want to see only the used levels, you can use the
186
-
:func:`MultiIndex.get_level_values` method.
186
+
:meth:`~MultiIndex.get_level_values` method.
187
187
188
188
.. ipython:: python
189
189
@@ -193,7 +193,7 @@ highly performant. If you want to see only the used levels, you can use the
193
193
df[['foo','qux']].columns.get_level_values(0)
194
194
195
195
To reconstruct the ``MultiIndex`` with only the used levels, the
196
-
``remove_unused_levels`` method may be used.
196
+
:meth:`~MultiIndex.remove_unused_levels` method may be used.
197
197
198
198
.. versionadded:: 0.20.0
199
199
@@ -400,8 +400,8 @@ You can use a right-hand-side of an alignable object as well.
400
400
Cross-section
401
401
~~~~~~~~~~~~~
402
402
403
-
The ``xs`` method of ``DataFrame`` additionally takes a level argument to make
404
-
selecting data at a particular level of a MultiIndex easier.
403
+
The :meth:`~DataFrame.xs` method of ``DataFrame`` additionally takes a level argument to make
404
+
selecting data at a particular level of a ``MultiIndex`` easier.
405
405
406
406
.. ipython:: python
407
407
@@ -519,7 +519,7 @@ to be sorted. As with any index, you can use ``sort_index``.
519
519
520
520
.. _advanced.sortlevel_byname:
521
521
522
-
You may also pass a level name to ``sort_index`` if the MultiIndex levels
522
+
You may also pass a level name to ``sort_index`` if the ``MultiIndex`` levels
523
523
are named.
524
524
525
525
.. ipython:: python
@@ -566,7 +566,8 @@ Furthermore, if you try to index something that is not fully lexsorted, this can
566
566
In [5]: dfm.loc[(0,'y'):(1, 'z')]
567
567
UnsortedIndexError: 'Key length (2) was greater than MultiIndex lexsort depth (1)'
568
568
569
-
The ``is_lexsorted()`` method on an ``Index`` show if the index is sorted, and the ``lexsort_depth`` property returns the sort depth:
569
+
The :meth:`~MultiIndex.is_lexsorted` method on a ``MultiIndex`` shows if the
570
+
index is sorted, and the ``lexsort_depth`` property returns the sort depth:
570
571
571
572
.. ipython:: python
572
573
@@ -591,8 +592,8 @@ Take Methods
591
592
592
593
.. _advanced.take:
593
594
594
-
Similar to NumPy ndarrays, pandas Index, Series, and DataFrame also provides
595
-
the ``take`` method that retrieves elements along a given axis at the given
595
+
Similar to NumPy ndarrays, pandas ``Index``, ``Series``, and ``DataFrame`` also provides
596
+
the :meth:`~DataFrame.take` method that retrieves elements along a given axis at the given
596
597
indices. The given indices must be either a list or an ndarray of integer
597
598
index positions. ``take`` will also accept negative integers as relative positions to the end of the object.
598
599
@@ -668,8 +669,8 @@ In the following sub-sections we will highlight some other index types.
668
669
CategoricalIndex
669
670
~~~~~~~~~~~~~~~~
670
671
671
-
``CategoricalIndex`` is a type of index that is useful for supporting
672
-
indexing with duplicates. This is a container around a ``Categorical``
672
+
:class:`CategoricalIndex` is a type of index that is useful for supporting
673
+
indexing with duplicates. This is a container around a :class:`Categorical`
673
674
and allows efficient indexing and storage of an index with a large number of duplicated elements.
674
675
675
676
.. ipython:: python
@@ -758,19 +759,19 @@ Int64Index and RangeIndex
758
759
759
760
Indexing on an integer-based Index with floats has been clarified in0.18.0, for a summary of the changes, see :ref:`here <whatsnew_0180.float_indexers>`.
760
761
761
-
``Int64Index``is a fundamental basic index in pandas.
762
-
This is an Immutable array implementing an ordered, sliceable set.
762
+
:class:`Int64Index`is a fundamental basic index in pandas.
763
+
This is an immutable array implementing an ordered, sliceable set.
763
764
Prior to 0.18.0, the ``Int64Index`` would provide the default index forall``NDFrame`` objects.
764
765
765
-
``RangeIndex``is a sub-class of ``Int64Index`` added in version 0.18.0, now providing the default index forall``NDFrame`` objects.
766
+
:class:`RangeIndex`is a sub-class of ``Int64Index`` added in version 0.18.0, now providing the default index forall``NDFrame`` objects.
766
767
``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>`__.
767
768
768
769
.. _indexing.float64index:
769
770
770
771
Float64Index
771
772
~~~~~~~~~~~~
772
773
773
-
By default a ``Float64Index`` will be automatically created when passing floating, or mixed-integer-floating values in index creation.
774
+
By default a :class:`Float64Index` will be automatically created when passing floating, or mixed-integer-floating values in index creation.
774
775
This enables a pure label-based slicing paradigm that makes ``[],ix,loc``for scalar indexing and slicing work exactly the
775
776
same.
776
777
@@ -875,9 +876,9 @@ IntervalIndex
875
876
876
877
.. versionadded:: 0.20.0
877
878
878
-
:class:`IntervalIndex` together with its own dtype, ``interval``as well as the
879
-
:class:`Interval` scalar type, allow first-class support in pandasfor interval
880
-
notation.
879
+
:class:`IntervalIndex` together with its own dtype, :class:`~pandas.api.types.IntervalDtype`
880
+
as well as the :class:`Interval` scalar type, allow first-class support in pandas
881
+
for interval notation.
881
882
882
883
The ``IntervalIndex`` allows some unique indexing andis also used as a
883
884
returntypefor the categories in :func:`cut`and :func:`qcut`.
0 commit comments