Skip to content

Commit

Permalink
DOC: Distinguish between different types of boolean indexing #10492 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
junjunjunk authored Oct 8, 2020
1 parent ea98a29 commit 5782dc0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions doc/source/user_guide/indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,24 @@ and :ref:`Advanced Indexing <advanced>` you may select along more than one axis
df2.loc[criterion & (df2['b'] == 'x'), 'b':'c']
.. warning::

``iloc`` supports two kinds of boolean indexing. If the indexer is a boolean ``Series``,
an error will be raised. For instance, in the following example, ``df.iloc[s.values, 1]`` is ok.
The boolean indexer is an array. But ``df.iloc[s, 1]`` would raise ``ValueError``.

.. ipython:: python
df = pd.DataFrame([[1, 2], [3, 4], [5, 6]],
index=list('abc'),
columns=['A', 'B'])
s = (df['A'] > 2)
s
df.loc[s, 'B']
df.iloc[s.values, 1]
.. _indexing.basics.indexing_isin:

Indexing with isin
Expand Down

0 comments on commit 5782dc0

Please sign in to comment.