python - Pandas: How do I check for value match between columns in same dataframe? -
i complete coding novice , have been experimenting pandas. first post. thank in advance help!
i remove rows cat1 not match either dog1 or dog2. not have match both, 1 or other.
cat1 dog1 dog2 0 red red blue 1 red green blue 2 blue red blue 3 blue blue green 4 red green blue
i end result follows:
cat1 dog1 dog2 0 red red blue 2 blue red blue 3 blue blue green
how do this?
this simple:
df.query('cat1 == dog1 or cat1 == dog2')
Comments
Post a Comment