Hi I'm trying to reshape a data frame in a certain way.
this is the data frame I have,
des1 des2 des3 interval1 interval2 interval3
value
aaa a b c ##1 ##2 ##3
bbb d e f ##4 ##5 ##6
ccc g h i ##7 ##8 ##9
des1 corresponds with interval1 and so on. interval columns have a range of dates and des columns have descriptions.
I'd like to reshape the dataframe such that it looks like this:
des interval
value
aaa a ##1
aaa b ##2
aaa c ##3
bbb d ##4
bbb e ##5
bbb f ##6
ccc g ##7
ccc h ##8
ccc i ##9
How would I go about doing this? I'm a little familar with .stack() but I haven't been able to get exactly what I wanted.
Thank you for your help. feel free to post references.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…