Skip to content

Commit ecd7b5e

Browse files
committed
DOC: add more links to advanced.rst
1 parent 1a12c41 commit ecd7b5e

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

doc/source/advanced.rst

+28-27
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
MultiIndex / Advanced Indexing
1616
******************************
1717

18-
This section covers indexing with a ``MultiIndex`` and :ref:`more advanced indexing features <indexing.index_types>`.
18+
This section covers :ref:`indexing with a MultiIndex <advanced.hierarchical>`
19+
and :ref:`other advanced indexing features <indexing.index_types>`.
1920

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

@@ -213,8 +214,8 @@ tuples:
213214
s + s[:-2]
214215
s + s[::2]
215216
216-
``reindex`` can be called with another ``MultiIndex``, or even a list or array
217-
of tuples:
217+
The :meth:`~DataFrame.reindex` method of Series/DataFrames can be called with
218+
another ``MultiIndex``, or even a list or array of tuples:
218219

219220
.. ipython:: python
220221
@@ -413,7 +414,7 @@ selecting data at a particular level of a ``MultiIndex`` easier.
413414
# using the slicers
414415
df.loc[(slice(None),'one'),:]
415416
416-
You can also select on the columns with :meth:`~pandas.MultiIndex.xs`, by
417+
You can also select on the columns with ``xs``, by
417418
providing the axis argument.
418419

419420
.. ipython:: python
@@ -426,7 +427,7 @@ providing the axis argument.
426427
# using the slicers
427428
df.loc[:,(slice(None),'one')]
428429
429-
:meth:`~pandas.MultiIndex.xs` also allows selection with multiple keys.
430+
``xs`` also allows selection with multiple keys.
430431

431432
.. ipython:: python
432433
@@ -437,7 +438,7 @@ providing the axis argument.
437438
# using the slicers
438439
df.loc[:,('bar','one')]
439440
440-
You can pass ``drop_level=False`` to :meth:`~pandas.MultiIndex.xs` to retain
441+
You can pass ``drop_level=False`` to ``xs`` to retain
441442
the level that was selected.
442443

443444
.. ipython:: python
@@ -460,9 +461,9 @@ Compare the above with the result using ``drop_level=True`` (the default value).
460461
Advanced reindexing and alignment
461462
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
462463

463-
The parameter ``level`` has been added to the ``reindex`` and ``align`` methods
464-
of pandas objects. This is useful to broadcast values across a level. For
465-
instance:
464+
Using the parameter ``level`` in the :meth:`~DataFrame.reindex` and
465+
:meth:`~DataFrame.align` methods of pandas objects is useful to broadcast
466+
values across a level. For instance:
466467

467468
.. ipython:: python
468469
@@ -480,10 +481,10 @@ instance:
480481
df2_aligned
481482
482483
483-
Swapping levels with :meth:`~pandas.MultiIndex.swaplevel`
484-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
484+
Swapping levels with ``swaplevel``
485+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
485486

486-
The ``swaplevel`` function can switch the order of two levels:
487+
The :meth:`~MultiIndex.swaplevel` method can switch the order of two levels:
487488

488489
.. ipython:: python
489490
@@ -492,21 +493,21 @@ The ``swaplevel`` function can switch the order of two levels:
492493
493494
.. _advanced.reorderlevels:
494495

495-
Reordering levels with :meth:`~pandas.MultiIndex.reorder_levels`
496-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
496+
Reordering levels with ``reorder_levels``
497+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
497498

498-
The ``reorder_levels`` function generalizes the ``swaplevel`` function,
499-
allowing you to permute the hierarchical index levels in one step:
499+
The :meth:`~MultiIndex.reorder_levels` method generalizes the ``swaplevel``
500+
method, allowing you to permute the hierarchical index levels in one step:
500501

501502
.. ipython:: python
502503
503504
df[:5].reorder_levels([1,0], axis=0)
504505
505-
Sorting a :class:`~pandas.MultiIndex`
506-
-------------------------------------
506+
Sorting a ``MultiIndex``
507+
------------------------
507508

508-
For MultiIndex-ed objects to be indexed and sliced effectively, they need
509-
to be sorted. As with any index, you can use ``sort_index``.
509+
For :class:`MultiIndex`-ed objects to be indexed and sliced effectively,
510+
they need to be sorted. As with any index, you can use :meth:`~DataFrame.sort_index`.
510511

511512
.. ipython:: python
512513
@@ -658,9 +659,9 @@ faster than fancy indexing.
658659
Index Types
659660
-----------
660661

661-
We have discussed ``MultiIndex`` in the previous sections pretty extensively. ``DatetimeIndex`` and ``PeriodIndex``
662-
are shown :ref:`here <timeseries.overview>`, and information about
663-
``TimedeltaIndex`` is found :ref:`here <timedeltas.timedeltas>`.
662+
We have discussed ``MultiIndex`` in the previous sections pretty extensively.
663+
Documentation about ``DatetimeIndex`` and ``PeriodIndex`` are shown :ref:`here <timeseries.overview>`,
664+
and documentation about ``TimedeltaIndex`` is found :ref:`here <timedeltas.timedeltaindex>`.
664665

665666
In the following sub-sections we will highlight some other index types.
666667

@@ -1004,8 +1005,8 @@ Non-monotonic indexes require exact matches
10041005
10051006
If the index of a ``Series`` or ``DataFrame`` is monotonically increasing or decreasing, then the bounds
10061007
of a label-based slice can be outside the range of the index, much like slice indexing a
1007-
normal Python ``list``. Monotonicity of an index can be tested with the ``is_monotonic_increasing`` and
1008-
``is_monotonic_decreasing`` attributes.
1008+
normal Python ``list``. Monotonicity of an index can be tested with the :meth:`~Index.is_monotonic_increasing` and
1009+
:meth:`~Index.is_monotonic_decreasing` attributes.
10091010
10101011
.. ipython:: python
10111012
@@ -1039,9 +1040,9 @@ On the other hand, if the index is not monotonic, then both slice bounds must be
10391040
In [11]: df.loc[2:3, :]
10401041
KeyError: 'Cannot get right slice bound for non-unique label: 3'
10411042
1042-
:meth:`Index.is_monotonic_increasing` and :meth:`Index.is_monotonic_decreasing` only check that
1043+
``Index.is_monotonic_increasing`` and ``Index.is_monotonic_decreasing`` only check that
10431044
an index is weakly monotonic. To check for strict monotonicity, you can combine one of those with
1044-
:meth:`Index.is_unique`
1045+
the :meth:`~Index.is_unique` attribute.
10451046
10461047
.. ipython:: python
10471048

0 commit comments

Comments
 (0)