I have an input data frame which looks like this:
print (df)
Id A B C D
0 101 0 0 0 1
1 102 0 0 0 0
2 103 1 0 1 0
3 104 1 0 1 1
Output: I want to print the indexes of the columns which contain '1' in it. The output data frame should look like this. If 1 is not present it should return an empty string.
Id 101- D (4th index) has 1
Id 102- None
Id 104- A, C and D which are 1,3,4 indexes
So, a sample output would look like:
print (df)
Id Result
0 101 4
1 102
2 103 1,3
3 104 1,3,4