python - How to display a row based on specific columns and values -


let's have dataframe:

type    |    killed dog            5 cat            7 dog            9 dog           10 dog            6 cat            2 cow            1 

i display row number of dogs killed more 7.

my desired outcome be:

type    |    killed dog            9 dog           10 

thank you!

you can select within column by:

df.loc[(df['killed'] > 7) & (df.index == 'dog')] 

Comments