回答編集履歴

1

追記

2019/11/01 01:53

投稿

barobaro
barobaro

スコア1286

test CHANGED
@@ -63,3 +63,27 @@
63
63
  df.to_csv("result.csv")
64
64
 
65
65
  ```
66
+
67
+
68
+
69
+ ## 追記
70
+
71
+
72
+
73
+ Pnadasによる縦持ち⇒横持ちデータ構造変換
74
+
75
+ [https://teratail.com/questions/186398](https://teratail.com/questions/186398)
76
+
77
+
78
+
79
+
80
+
81
+ ```python
82
+
83
+ df = df_csv.groupby(["会社名"]).apply(lambda d: d['名前'].reset_index(drop=True)).unstack()
84
+
85
+ df = df.rename(columns={i:'担当者{:02d}'.format(i+1) for i in range(10)})
86
+
87
+ df
88
+
89
+ ```