0

I have a pandas dataframe containing data and a python list which contains ids. I want to extract data from the pandas dataframe which matches with the values of list.

ids = ['SW00003062', 'SW00003063', 'SW00003067', 'SW00003072'] Dataframe is this:

Pandas dataframe

1 Answers1

0

You can use isin

out = df[df['id'].isin(ids)]
Ynjxsjmh
  • 28,441
  • 6
  • 34
  • 52