I have the following df:
user 2019-01-01 2019-01-02
0 Me 1.0 3.0
1 Myself 2.0 2.0
2 And_Irene 3.0 1.0
I want to transform this into the following:
Count
2019-01-01 Me 1.0
2019-01-01 Myself 2.0
2019-01-01 And_Irene 3.0
2019-01-02 Me 3.0
2019-01-02 Myself 2.0
2019-01-02 And_Irene 1.0
I think this has to be done through df.T
, but I am not sure what the next steps should be. Using df.T
returns:
0 1 2
user Me Myself And_Irene
2019-01-01 1 2 3
2019-01-02 3 2 1
But then, how can I group the results using the column names? I am not sure this is the right way to do this.