Let's say have a giant dataframe documenting the number of animals in a zoo
[Animal] ... [number]
[cow] ... [3]
[fish] ... [6]
.
.
.
[pig] ... [5]
and I want to reduce this to look at n specific animals
then I would do something like this
df = df.loc[["Animal"]=="cow" | ["Animal"]=="pig" | ...]
for as many animals as I want
but how can I do this so for any given set
set = ["cow", "pig", .... ]
something of the form
df = df.loc[["Animal"] == i for i in set]
but this would make the union (i.e. it would look for places where Animal = cow AND pig AND all everything else)
Is there a version where It will look for the intersection ( i.e. Animal = cow OR pig OR anything else)