0

Data frame is below

import pandas as pd
import io
s = '''uid,col1,flag
1001,rejected,Audi
1002,verified,Benz
1003,verified,Ferrari
1004,rejected,Tesla'''
df_j = pd.read_csv(io.StringIO(s))

Need to extract the row which verified Expected out is below

1002
1003

1 Answers1

0

You can use combination of boolean indexing and selecting by DataFrame.loc:

s = df_j.loc[df_j['col1'] == 'verified', 'uid']
print (s)
1    1002
2    1003
Name: uid, dtype: int64
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252