1 1 0 0 0 1 0 0 0
0 1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0
1 0 1 0 0 0 0 0 0
0 0 0 0 0 0 1 1 1
1 0 0 1 1 0 0 0 0
I have a dataframe of the above structure. I want to get the columns which has a column sum of 1. The columns should be combined together if they have 1's for the same row. So if we see the above example we should get column [3],[4,5],[6],[7,8,9] as output. I tried doingdf.columns[df.sum(axis=0) == 1] but instead of getting them in group(when they have same row's) I am getting them as individual...