I have a dataframe as below
I would like to convert it into the following dataframe
how can i do this?
I have a dataframe as below
I would like to convert it into the following dataframe
how can i do this?
Edit 1: I figured out how to do this. Pandas has a stack function which can do this function. Also check out pivot.
Would you be able to post the code solution you used to fix this for future people that may have this same type of situation?
Sure
Try this :
stacked = df.stack()
stacked = stacked.to_frame()
stacked = stacked.reset_index()
stacked= stacked.drop(['level_0'], axis = 1)