I have a dataframe where I've used get_dummies to create several columns (df.earth, df.wind, df.water, df.fire, df.heart - for example) and groupby to aggregate rows, so now a row can have multiple dummy columns with 1. The dataframe now looks like this:
ID Earth Wind Water Fire Heart
12 0 1 1 0 1
13 1 0 0 0 0
14 1 0 1 0 0
I need to create a column that checks each dummy column and writes the column names that apply for each row that would look like this:
ID Earth Wind Water Fire Heart Powers
12 0 1 1 0 1 Wind, Water, Heart
13 1 0 1 0 0 Earth, Water
14 1 0 1 0 0 Earth, Water, Heart
I'm not really sure where to start, and my searching hasn't gotten me very far.