Here is the data frame
big = pd.DataFrame({'group': ['A', 'A', 'A','A', 'B','B','C','D','D', 'D'], 'animal': ['ALL other', 'cat','rabbit', 'dog', 'rabbit','ALL other', 'ALL', 'ALL other', 'dog','cat']})
big
group animal
0 A ALL other
1 A cat
2 A rabbit
3 A dog
4 B rabbit
5 B ALL other
6 C ALL
7 D ALL other
8 D dog
9 D cat
the rule is that if rabbit in the group then pick out the group, if the animal is 'ALL' then pick all and regard it as rabbit, if there is no rabbit in the group then pick 'ALL other' and regard it as rabbit.
The small data frame is below
group animal
0 A rabbit
1 B rabbit
2 C ALL
3 D ALL other