回答編集履歴

2

修正

2021/01/13 15:14

投稿

退会済みユーザー
test CHANGED
@@ -12,7 +12,11 @@
12
12
 
13
13
  newdata = pd.pivot_table(d0, index=['ExNo','M1','M2','M3']).reset_index()
14
14
 
15
+ # 列の順番を元に戻す
15
16
 
17
+ col = d0.columns.values
18
+
19
+ newdata = newdata.loc[:, col]
16
20
 
17
21
  print(newdata)
18
22
 

1

修正

2021/01/13 15:14

投稿

退会済みユーザー
test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  d0 = pd.read_csv('test.csv')
12
12
 
13
- newdata = pd.pivot_table(d0, index=['ExNo','M1','M1_wt%','M2','M2_wt%','M3','M3_wt%']).reset_index()
13
+ newdata = pd.pivot_table(d0, index=['ExNo','M1','M2','M3']).reset_index()
14
14
 
15
15
 
16
16