0
i have a dataframe looks like this : 
Time                 A   B   C  D
01-05-2021 00:00:00  11  10  5  5
01-05-2021 00:15:00   5  3   4  5
01-05-2021 00:30:00   8  3   3  7
01-05-2021 00:45:00   6  4   4  5

and i want to convert it to something like that :

    Time                     count   station  
        01-05-2021 00:00:00  11       A
        01-05-2021 00:00:00  10       B
        01-05-2021 00:00:00  5        C
        01-05-2021 00:00:00  5        D
        01-05-2021 00:15:00  5        A
        .....
        01-05-2021 00:45:00   5       D

does any one have any idea how to do that?

Hermion
  • 25
  • 6

1 Answers1

0

This should work, supposing that 'Time' is your index:

df = pd.melt(df)
luka1156
  • 181
  • 1
  • 8