Skip to content

DOC: Distinguish between different types of boolean indexing #10492 #36869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 8, 2020
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