Skip to content

Commit 43fa160

Browse files
authored
DOC: Clean .ix references in indexing.rst (#38080)
1 parent 5c73d99 commit 43fa160

File tree

2 files changed

+5
-33
lines changed

2 files changed

+5
-33
lines changed

doc/source/user_guide/indexing.rst

+4-32
Original file line numberDiff line numberDiff line change
@@ -584,48 +584,20 @@ 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.
588+
.. _combining_positional_and_label_based_indexing:
597589

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.
590+
Combining positional and label-based indexing
591+
---------------------------------------------
601592

602-
The recommended methods of indexing are:
603-
604-
* ``.loc`` if you want to *label* index.
605-
* ``.iloc`` if you want to *positionally* index.
593+
If you wish to get the 0th and the 2nd elements from the index in the 'A' column, you can do:
606594

607595
.. ipython:: python
608596
609597
dfd = pd.DataFrame({'A': [1, 2, 3],
610598
'B': [4, 5, 6]},
611599
index=list('abc'))
612-
613600
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
618-
619-
In [3]: dfd.ix[[0, 2], 'A']
620-
Out[3]:
621-
a 1
622-
c 3
623-
Name: A, dtype: int64
624-
625-
Using ``.loc``. Here we will select the appropriate indexes from the index, then use *label* indexing.
626-
627-
.. ipython:: python
628-
629601
dfd.loc[dfd.index[[0, 2]], 'A']
630602
631603
This can also be expressed using ``.iloc``, by explicitly getting locations on the indexers, and using

doc/source/whatsnew/v0.20.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ The recommended methods of indexing are:
13151315
- ``.loc`` if you want to *label* index
13161316
- ``.iloc`` if you want to *positionally* index.
13171317

1318-
Using ``.ix`` will now show a ``DeprecationWarning`` with a link to some examples of how to convert code :ref:`here <indexing.deprecate_ix>`.
1318+
Using ``.ix`` will now show a ``DeprecationWarning`` with a link to some examples of how to convert code `here <https://pandas.pydata.org/pandas-docs/version/1.0/user_guide/indexing.html#ix-indexer-is-deprecated>`__.
13191319

13201320

13211321
.. ipython:: python

0 commit comments

Comments
 (0)