@@ -654,7 +654,7 @@ instance:
654
654
655
655
.. ipython :: python
656
656
657
- midx = MultiIndex(levels = [[' one ' , ' two ' ], [' x' ,' y' ]],
657
+ midx = MultiIndex(levels = [[' zero ' , ' one ' ], [' x' ,' y' ]],
658
658
labels = [[1 ,1 ,0 ,0 ],[1 ,0 ,1 ,0 ]])
659
659
df = DataFrame(randn(4 ,2 ), index = midx)
660
660
print df
@@ -670,13 +670,15 @@ The need for sortedness
670
670
~~~~~~~~~~~~~~~~~~~~~~~
671
671
672
672
**Caveat emptor **: the present implementation of ``MultiIndex `` requires that
673
- the labels be lexicographically sorted into groups for some of the slicing /
674
- indexing routines to work correctly. You can think about this as meaning that
675
- the axis is broken up into a tree structure, where every leaf in a particular
676
- branch shares the same labels at that level of the hierarchy. However, the
677
- ``MultiIndex `` does not enforce this: **you are responsible for ensuring that
678
- things are properly sorted **. There is an important new method ``sortlevel ``
679
- which will lexicographically sort an axis with a ``MultiIndex ``:
673
+ the labels be sorted for some of the slicing / indexing routines to work
674
+ correctly. You can think about breaking the axis into unique groups, where at
675
+ the hierarchical level of interest, each distinct group shares a label, but no
676
+ two have the same label. However, the ``MultiIndex `` does not enforce this:
677
+ **you are responsible for ensuring that things are properly sorted **. There is
678
+ an important new method ``sortlevel `` to sort an axis within a ``MultiIndex ``
679
+ so that its labels are grouped and sorted by the original ordering of the
680
+ associated factor at that level. Note that this does not necessarily mean the
681
+ labels will be sorted lexicographically!
680
682
681
683
.. ipython :: python
682
684
0 commit comments