我的问题与这篇文章有关:
How to filter csv data by applying conditions on certain columns in python
我如何申请其他条件?例如,当Energy_Supply_per_capita>时,我想我只对阿尔巴尼亚和赞比亚感兴趣。 280和emissions_of_co2< 30?感谢
答案 0 :(得分:1)
试试这个:
q = "Country_Area in ['Albania','Zambia'] "+\
"and Energy_Supply_per_capita > 280 "+\
"and emissions_of_co2 < 30"
df.query(q)