I have the following pandas Dataframe df
:
ctype cdate cval1 cval2
1 2020-01-01 34 A
2 2020-01-01 33 B
3 2020-01-01 21 A
1 2020-01-02 35 A
2 2020-01-02 30 C
3 2020-01-02 28 B
I need to convert ctype
column inot rows to get the following dataframe:
cdate cval1_1 cval1_2 cval_3 cval2_1 cval2_2 cval2_3
2020-01-01 34 33 21 A B A
2020-01-02 35 30 28 A C B
How can I get such result?