Skip to content

Commit cdab269

Browse files
committed
DOC: documented swaplevel, address GH #150
1 parent 6fa7df2 commit cdab269

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

doc/source/dsintro.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,6 @@ The API for insertion and deletion is the same as for DataFrame.
513513
Indexing / Selection
514514
~~~~~~~~~~~~~~~~~~~~
515515

516-
As of this writing, indexing with Panel is a bit more restrictive than in
517-
DataFrame. Notably, :ref:`advanced indexing <indexing>` via the **ix** property
518-
has not yet been integrated in Panel. This will be done, however, in a
519-
future release.
520-
521516
.. csv-table::
522517
:header: "Operation", "Syntax", "Result"
523518
:widths: 30, 20, 10

doc/source/indexing.rst

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,19 +291,16 @@ than integer locations. Therefore, advanced indexing with ``.ix`` will always
291291
Setting values in mixed-type objects
292292
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
293293

294-
Setting values on a mixed-type DataFrame or Panel is not yet supported:
294+
Setting values on a mixed-type DataFrame or Panel is supported when using scalar
295+
values, though setting arbitrary vectors is not yet supported:
295296

296297
.. ipython:: python
297298
298299
df2 = df[:4]
299300
df2['foo'] = 'bar'
300301
df2.ix[3]
301302
df2.ix[3] = np.nan
302-
303-
The reason it has not been implemented yet is simply due to difficulty of
304-
implementation relative to its utility. Handling the full spectrum of
305-
exceptional cases for setting values is trickier than getting values (which is
306-
relatively straightforward).
303+
df2
307304
308305
.. _indexing.hierarchical:
309306

@@ -523,6 +520,16 @@ However:
523520
>>> s.ix[('a', 'b'):('b', 'a')]
524521
Exception: MultiIndex lexsort depth 1, key was length 2
525522

523+
Swapping levels with ``swaplevel``
524+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
525+
526+
The ``swaplevel`` function can switch the order of two levels:
527+
528+
.. ipython:: python
529+
530+
df[:5]
531+
df[:5].swaplevel(0, 1, axis=0)
532+
526533
The ``delevel`` DataFrame function
527534
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
528535

0 commit comments

Comments
 (0)