回答編集履歴

2

補足を追加

2017/09/12 05:29

投稿

magichan
magichan

スコア15898

test CHANGED
@@ -29,3 +29,47 @@
29
29
  print(grouped_df.as_matrix())
30
30
 
31
31
  ```
32
+
33
+
34
+
35
+ ---
36
+
37
+
38
+
39
+ **【補足】**
40
+
41
+
42
+
43
+ ```Python
44
+
45
+ import matplotlib.pyplot as plt
46
+
47
+ # テーブル全体の基本統計量を表示
48
+
49
+ print(df.describe())
50
+
51
+ # テーブル全体の積算を表示
52
+
53
+ print(df.sum())
54
+
55
+ # グループ毎の積算を表示
56
+
57
+ print(grp.sum())
58
+
59
+ # グループ毎の平均を表示
60
+
61
+ print(grp.mean())
62
+
63
+ # グループよりcol2が7のグループを取得
64
+
65
+ grp7_df = grp.get_group(7)
66
+
67
+ # 上記のグループ(col2=7)をx軸(col0),y軸(col3)でプロット
68
+
69
+ grp7_df.plot(kind='scatter', x=0,y=3)
70
+
71
+ plt.show()
72
+
73
+ ```
74
+
75
+

1

タイポを修正

2017/09/12 05:29

投稿

magichan
magichan

スコア15898

test CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  df = pd.read_csv(fname, sep=' ', header=None)
20
20
 
21
- # 3目の値でグループ分け
21
+ # 3目の値でグループ分け
22
22
 
23
23
  grp = df.groupby(2)
24
24