I am very new to python . should I be using the pivot or unstack to get the expected output. Any sample code is appreciated.
Sample Input is
==================
year c1 c2 time date entered week rank
2000 AA SSS1 4:22 2000-02-26 wk1 87
2000 BB SSS2 3:15 2000-09-02 wk1 91
2000 CC SSS3 3:53 2000-04-08 wk1 81
2000 CC SSS4 4:24 2000-10-21 wk1 76
2000 DD SSS5 3:35 2000-04-15 wk1 57
2000 AA SSS1 4:22 2000-02-26 wk2 82
2000 BB SSS2 3:15 2000-09-02 wk2 87
2000 CC SSS3 3:53 2000-04-08 wk2 70
2000 CC SSS4 4:24 2000-10-21 wk2 76
2000 DD SSS5 3:35 2000-04-15 wk2 34
2000 AA SSS1 4:22 2000-02-26 wk3 72
2000 BB SSS2 3:15 2000-09-02 wk3 92
2000 CC SSS3 3:53 2000-04-08 wk3 68
2000 CC SSS4 4:24 2000-10-21 wk3 72
2000 DD SSS5 3:35 2000-04-15 wk3 25
Expecting ouput :
++++++++++++++++++++
year c1 c2 time date entered wk1 wk2 wk3
2000 AA SSS1 4:22 2000-02-26 87 82 72
2000 BB SSS2 3:15 2000-09-02 91 87 92
2000 CC SSS3 3:53 2000-04-08 81 70 68
2000 CC SSS4 4:24 2000-10-21 76 76 72
2000 DD SSS5 3:35 2000-04-15 57 34 25
molten7 is above mentioned input
KeyError: ('c1', 'c2', 'time', 'date entered') ....
Sample Input is
==================
year c1 c2 time date entered week rank
2000 AA SSS1 4:22 2000-02-26 wk1 87
2000 BB SSS2 3:15 2000-09-02 wk1 91
2000 CC SSS3 3:53 2000-04-08 wk1 81
2000 CC SSS4 4:24 2000-10-21 wk1 76
2000 DD SSS5 3:35 2000-04-15 wk1 57
2000 AA SSS1 4:22 2000-02-26 wk2 82
2000 BB SSS2 3:15 2000-09-02 wk2 87
2000 CC SSS3 3:53 2000-04-08 wk2 70
2000 CC SSS4 4:24 2000-10-21 wk2 76
2000 DD SSS5 3:35 2000-04-15 wk2 34
2000 AA SSS1 4:22 2000-02-26 wk3 72
2000 BB SSS2 3:15 2000-09-02 wk3 92
2000 CC SSS3 3:53 2000-04-08 wk3 68
2000 CC SSS4 4:24 2000-10-21 wk3 72
2000 DD SSS5 3:35 2000-04-15 wk3 25
Expecting ouput :
++++++++++++++++++++
year c1 c2 time date entered wk1 wk2 wk3
2000 AA SSS1 4:22 2000-02-26 87 82 72
2000 BB SSS2 3:15 2000-09-02 91 87 92
2000 CC SSS3 3:53 2000-04-08 81 70 68
2000 CC SSS4 4:24 2000-10-21 76 76 72
2000 DD SSS5 3:35 2000-04-15 57 34 25
molten7 is above mentioned input
tidy7 = molten7.pivot(index=('c1','c2','time','date entered'),columns='week',values='rank')give me the following error
KeyError: ('c1', 'c2', 'time', 'date entered') ....