0

You can slice the dataframe by a equality check

df[df['column'] == 'key']

How do I slice the dataframe via a check into a set?

df[df['column'] in set(['key', 'key2', key3'])]
samol
  • 18,950
  • 32
  • 88
  • 127
  • Possible duplicate of [Select rows from a DataFrame based on values in a column in pandas](https://stackoverflow.com/questions/17071871/select-rows-from-a-dataframe-based-on-values-in-a-column-in-pandas) – Quang Hoang May 27 '19 at 21:05
  • Possible duplicate of [How to implement 'in' and 'not in' for Pandas dataframe](https://stackoverflow.com/questions/19960077/how-to-implement-in-and-not-in-for-pandas-dataframe) – Erfan May 27 '19 at 21:14

1 Answers1

2
df[df["column"].isin(["key1", "key2", "key3"])]

This will do it.

secretive
  • 2,032
  • 7
  • 16