I am new to python and can't seem to find a solution. Currently, my pandas dataframe is of format:
841 818 813 800 788
399 3.0 4.0 3.0 NaN NaN
400 NaN NaN NaN 3.0 3.0
Where 399 and 400 are unique ids. I am trying to make it so that unique ids will repeat until all columns are separated as rows. Like this:
399 841 3.0
399 818 4.0
...
400 841 NaN
400 818 NaN
...
Any help would be appreciated, thanks!
df.stack(dropna=False)?df.stack(dropna=False).reset_index().