回答編集履歴
1
Update
test
CHANGED
@@ -16,7 +16,9 @@
|
|
16
16
|
|
17
17
|
# pivot
|
18
18
|
|
19
|
-
dfy = df.pivot_table(index='name', columns='subject', values='score')
|
19
|
+
dfy = df.pivot_table(index='name', columns='subject', values='score', sort=False)
|
20
|
+
|
21
|
+
dfy = dfy[['math','english','physics']] # columns order
|
20
22
|
|
21
23
|
print(dfy)
|
22
24
|
|
@@ -34,14 +36,14 @@
|
|
34
36
|
|
35
37
|
|
36
38
|
|
37
|
-
subject english
|
39
|
+
subject math english physics
|
38
40
|
|
39
41
|
name
|
40
42
|
|
41
|
-
|
43
|
+
Taro 86 92 80
|
42
44
|
|
43
|
-
|
45
|
+
Jiro 92 97 90
|
44
46
|
|
45
|
-
|
47
|
+
Ken 100 70 92
|
46
48
|
|
47
49
|
```
|