Lets say i have i dataframe like this one:
col1 col2 col3
0 data1 Completed Fail
1 data2 Completed NaN
2 data3 Completed Completed
3 data4 Completed NaN
4 data5 NaN NaN
How can i add an extra row for each time the value in col3 is not NaN and have a dataframe like this:
col1 status
0 data1 Completed
1 data1 Fail
2 data2 Completed
3 data3 Completed
4 data3 Completed
5 data4 Completed
6 data5 NaN
I tried this but im not getting the desirable output:
df = df.melt(id_vars=['col1'],
value_name="status")