Skip to content

MultiIndex Doc #18169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions doc/source/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ on a deeper level.
Defined Levels
~~~~~~~~~~~~~~

The repr of a ``MultiIndex`` shows ALL the defined levels of an index, even
The repr of a ``MultiIndex`` shows all the defined levels of an index, even
if the they are not actually used. When slicing an index, you may notice this.
For example:

.. ipython:: python

# original multi-index
df.columns
  # original MultiIndex
  df.columns

# sliced
df[['foo','qux']].columns
Expand Down Expand Up @@ -264,7 +264,7 @@ Passing a list of labels or tuples works similar to reindexing:
Using slicers
~~~~~~~~~~~~~

You can slice a multi-index by providing multiple indexers.
You can slice a ``MultiIndex`` by providing multiple indexers.

You can provide any of the selectors as if you are indexing by label, see :ref:`Selection by Label <indexing.label>`,
including slices, lists of labels, labels, and boolean indexers.
Expand All @@ -278,16 +278,16 @@ As usual, **both sides** of the slicers are included as this is label indexing.

You should specify all axes in the ``.loc`` specifier, meaning the indexer for the **index** and
for the **columns**. There are some ambiguous cases where the passed indexer could be mis-interpreted
as indexing *both* axes, rather than into say the MuliIndex for the rows.
  as indexing *both* axes, rather than into say the ``MultiIndex`` for the rows.

You should do this:

.. code-block:: python

df.loc[(slice('A1','A3'),.....), :]

rather than this:

  rather than this:
 
.. code-block:: python

df.loc[(slice('A1','A3'),.....)]
Expand Down Expand Up @@ -494,7 +494,7 @@ are named.
s.sort_index(level='L2')

On higher dimensional objects, you can sort any of the other axes by level if
they have a MultiIndex:
they have a ``MultiIndex``:

.. ipython:: python

Expand Down