繁体   English   中英

如何使用python考虑其他两个变量对一个变量应用过滤器

[英]how to apply filter on one variable considering other two variable using python

我的数据包含变量participantsoriginscore 我想要那些得分greater than 60参与者和来源。 这意味着过滤参与者我必须考虑来源和分数。 我只能根据原点或分数进行过滤,但它不起作用。

如果有人可以帮助我,那就太好了!!!

我认为您可以使用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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM