Skip to content

Commit 92052ca

Browse files
committed
DOC: a bit more, and noticed a bug :(
1 parent cfc14fb commit 92052ca

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

doc/source/indexing.rst

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ can think of MultiIndex an array of tuples where each tuple is unique. A
345345

346346
.. ipython:: python
347347
348-
arrays = [['bar', 'bar', 'baz', 'baz', 'qux', 'qux', 'foo', 'foo'],
348+
arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
349349
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]
350350
tuples = zip(*arrays)
351351
tuples
@@ -362,18 +362,47 @@ of the index is up to you:
362362
df
363363
DataFrame(randn(6, 6), index=index[:6], columns=index[:6])
364364
365+
We've "sparsified" the higher levels of the indexes to make the console output a
366+
bit easier on the eyes.
367+
368+
It's worth keeping in mind that there's nothing preventing you from using tuples
369+
as atomic labels on an axis:
370+
371+
.. ipython:: python
372+
373+
Series(randn(8), index=tuples)
374+
375+
The reason that the MultiIndex matters is that it can allow you to do grouping,
376+
selection, and reshaping operations as we will describe below and in subsequent
377+
areas of the documentation.
378+
365379
Basic indexing on axis with MultiIndex
366380
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
367381

382+
One of the important features of hierarchical indexing is that you can select
383+
data by a "partial" label identifying a subgroup in the data. **Partial**
384+
selection "drops" levels of the hierarchical index in the result in a completely
385+
analogous way to selecting a column in a regular DataFrame:
386+
368387
.. ipython:: python
369388
370389
df['bar']
390+
df['bar', 'one']
391+
df['bar']['one']
392+
s['qux']
371393
372394
Advanced indexing with hierarchical index
373395
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
374396

375-
Interaction with ``reindex``
376-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
397+
Data alignment and ``reindex``
398+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
399+
400+
401+
402+
"Sortedness" issues
403+
~~~~~~~~~~~~~~~~~~~
404+
405+
377406

378407
Indexing internal details
379408
-------------------------

0 commit comments

Comments
 (0)