Skip to content

Commit 89604e6

Browse files
committed
DOC: Clean .ix references in indexing.rst
1 parent d8a2e74 commit 89604e6

File tree

1 file changed

+4
-36
lines changed

1 file changed

+4
-36
lines changed

doc/source/user_guide/indexing.rst

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -584,45 +584,13 @@ without using a temporary variable.
584584
(bb.groupby(['year', 'team']).sum()
585585
.loc[lambda df: df['r'] > 100])
586586
587-
.. _indexing.deprecate_ix:
588587
589-
IX indexer is deprecated
590-
------------------------
591-
592-
.. warning::
593-
594-
.. versionchanged:: 1.0.0
595-
596-
The ``.ix`` indexer was removed, in favor of the more strict ``.iloc`` and ``.loc`` indexers.
597-
598-
``.ix`` offers a lot of magic on the inference of what the user wants to do. To wit, ``.ix`` can decide
599-
to index *positionally* OR via *labels* depending on the data type of the index. This has caused quite a
600-
bit of user confusion over the years.
601-
602-
The recommended methods of indexing are:
603-
604-
* ``.loc`` if you want to *label* index.
605-
* ``.iloc`` if you want to *positionally* index.
606-
607-
.. ipython:: python
608-
609-
dfd = pd.DataFrame({'A': [1, 2, 3],
610-
'B': [4, 5, 6]},
611-
index=list('abc'))
612-
613-
dfd
614-
615-
Previous behavior, where you wish to get the 0th and the 2nd elements from the index in the 'A' column.
616-
617-
.. code-block:: ipython
588+
.. _combining_positional_and_label_based_indexing:
618589

619-
In [3]: dfd.ix[[0, 2], 'A']
620-
Out[3]:
621-
a 1
622-
c 3
623-
Name: A, dtype: int64
590+
Combining positional and label-based indexing
591+
---------------------------------------------
624592

625-
Using ``.loc``. Here we will select the appropriate indexes from the index, then use *label* indexing.
593+
If you wish to get the 0th and the 2nd elements from the index in the 'A' column, you can do:
626594

627595
.. ipython:: python
628596

0 commit comments

Comments
 (0)