回答編集履歴
1
d
test
CHANGED
@@ -15,3 +15,47 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
最初の10行ぐらいでいいので、csv ファイルをテキストエディタで開いた中身を質問に追記していただけますか。
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
## 追記
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
matplotlib で直接描画することもできますが、DataFrame からグラフを作成する場合は seaborn を使うことをおすすめします。
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
[seaborn.barplot — seaborn 0.9.0 documentation](https://seaborn.pydata.org/generated/seaborn.barplot.html)
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
`pip install seaborn` でインストールできます。
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
```python
|
38
|
+
|
39
|
+
import pandas as pd
|
40
|
+
|
41
|
+
import seaborn as sns
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
sns.set()
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
# DataFrame を作成する処理
|
50
|
+
|
51
|
+
# 省略
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
ax = sns.barplot(x="sex", y="rev", data=df)
|
56
|
+
|
57
|
+
ax.set_xlabel('sex')
|
58
|
+
|
59
|
+
ax.set_ylabel('revenue')
|
60
|
+
|
61
|
+
```
|