I am having data with variables participants
, origin
, and score
. And I want those participants and origin whose score is greater than 60
. That means to filter participants I have to consider origin and score. I can filter only on origin or only on score but it will not work.
If anyone can help me, its great!!!
I think you can use boolean indexing
:
df = pd.DataFrame({'participants':['a','s','d'],
'origin':['f','g','t'],
'score':[7,80,9]})
print (df)
origin participants score
0 f a 7
1 g s 80
2 t d 9
df = df[df.score > 60]
print (df)
origin participants score
1 g s 80
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.