animals = pd.DataFrame({'monkey': [0, 1, 0, 0, 0], 'rabbit': [1, 0, 0, 0, 0
    ], 'fox': [0, 0, 1, 0, 0]})

def get_animal(row):
    for c in animals.columns:
        if row[c] == 1:
            return c
animals.apply(get_animal, axis=1)
Reversing 'one-hot' encoding in Pandas