selecting rows based on multiple column values in pandas dataframe

前端 未结 4 724
梦如初夏
梦如初夏 2021-02-12 09:41

I have a pandas DataFrame df:

import pandas as pd

data = {\"Name\": [\"AAAA\", \"BBBB\"],
        \"C1\": [25, 12],
              


        
4条回答
  •  猫巷女王i
    2021-02-12 10:29

    I like to use df.query() for these kind of things

    df.query('C1>=0 and C1<=20 and C2>=0 and C2<=20 and C3>=0 and C3<=20')
    

提交回复
热议问题