Input dataframe is as follows:
import pandas as pd
df_input = pd.DataFrame([[1,0,0,0,0], [0,1,0,0,0], [0,0,1,0,0],[0,0,0,1,0],[0,0,0,0,1]], columns=["A", "B","C","D","E"])
For all the rows, only one column has non zero entry. Accordingly, the output dataframe I am expecting is as follows:-
df_output=pd.DataFrame(['A','B','C','D','E'],columns=['Alphabet'])
The alphabet column should have the column name of non zero value. Please suggest