From 89604e6431d1605eea83059cca6bc149a0e16845 Mon Sep 17 00:00:00 2001 From: tp Date: Thu, 26 Nov 2020 13:55:47 +0000 Subject: [PATCH] DOC: Clean .ix references in indexing.rst --- doc/source/user_guide/indexing.rst | 40 +++--------------------------- 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/doc/source/user_guide/indexing.rst b/doc/source/user_guide/indexing.rst index d456289c5c3f4..00afb42c880bd 100644 --- a/doc/source/user_guide/indexing.rst +++ b/doc/source/user_guide/indexing.rst @@ -584,45 +584,13 @@ without using a temporary variable. (bb.groupby(['year', 'team']).sum() .loc[lambda df: df['r'] > 100]) -.. _indexing.deprecate_ix: -IX indexer is deprecated ------------------------- - -.. warning:: - - .. versionchanged:: 1.0.0 - - The ``.ix`` indexer was removed, in favor of the more strict ``.iloc`` and ``.loc`` indexers. - -``.ix`` offers a lot of magic on the inference of what the user wants to do. To wit, ``.ix`` can decide -to index *positionally* OR via *labels* depending on the data type of the index. This has caused quite a -bit of user confusion over the years. - -The recommended methods of indexing are: - -* ``.loc`` if you want to *label* index. -* ``.iloc`` if you want to *positionally* index. - -.. ipython:: python - - dfd = pd.DataFrame({'A': [1, 2, 3], - 'B': [4, 5, 6]}, - index=list('abc')) - - dfd - -Previous behavior, where you wish to get the 0th and the 2nd elements from the index in the 'A' column. - -.. code-block:: ipython +.. _combining_positional_and_label_based_indexing: - In [3]: dfd.ix[[0, 2], 'A'] - Out[3]: - a 1 - c 3 - Name: A, dtype: int64 +Combining positional and label-based indexing +--------------------------------------------- -Using ``.loc``. Here we will select the appropriate indexes from the index, then use *label* indexing. +If you wish to get the 0th and the 2nd elements from the index in the 'A' column, you can do: .. ipython:: python