Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/source/user_guide/cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,15 @@ Ambiguity arises when an index consists of integers with a non-zero start or non

df[~((df.AAA <= 6) & (df.index.isin([0, 2, 4])))]

Using isin() to filter for values directly (this returns a series of boolean values).

.. ipython:: python

df = pd.DataFrame(
{"AAA": [4, 5, 6, 7], "BBB": [10, 20, 30, 40], "CCC": [100, 50, -30, -50]}
)
df["AAA"].isin([5, 7])

New columns
***********

Expand Down