質問編集履歴
4
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,8 +24,116 @@
|
|
24
24
|
|
25
25
|
```
|
26
26
|
|
27
|
+
The default interactive shell is now zsh.
|
28
|
+
|
29
|
+
To update your account to use zsh, please run `chsh -s /bin/zsh`.
|
30
|
+
|
31
|
+
For more details, please visit https://support.apple.com/kb/HT208050.
|
32
|
+
|
33
|
+
toko/opt/anaconda3/bin/activateAir:kivy sandairisatoko$ source /Users/sandairisa
|
34
|
+
|
35
|
+
/Users/sandairisatoko/opt/anaconda3/envs/Kivy/bin/python /Users/sandairisatoko/Desktop/kivy/image/vanalysis09.py
|
36
|
+
|
37
|
+
(base) sandairisatokonoMacBook-Air:kivy sandairisatoko$ /Users/sandairisatoko/opt/anaconda3/envs/Kivy/bin/python /Users/sandairisatoko/Desktop/kivy/image/vanalysis09.py
|
38
|
+
|
39
|
+
conda activate Kivy
|
40
|
+
|
41
|
+
/Users/sandairisatoko/opt/anaconda3/envs/Kivy/bin/python /Users/sandairisatoko/Desktop/kivy/image/vanalysis09.py
|
42
|
+
|
43
|
+
Traceback (most recent call last):
|
44
|
+
|
45
|
+
File "/Users/sandairisatoko/Desktop/kivy/image/vanalysis09.py", line 56, in <module>
|
46
|
+
|
47
|
+
ax.hist(X.iloc[:,i], bins=10, color='#000000')
|
48
|
+
|
49
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/__init__.py", line 1447, in inner
|
50
|
+
|
51
|
+
return func(ax, *map(sanitize_sequence, args), **kwargs)
|
52
|
+
|
53
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 6576, in hist
|
54
|
+
|
55
|
+
self._process_unit_info(xdata=x[0], kwargs=kwargs)
|
56
|
+
|
57
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 2189, in _process_unit_info
|
58
|
+
|
59
|
+
kwargs = _process_single_axis(xdata, self.xaxis, 'xunits', kwargs)
|
60
|
+
|
61
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 2172, in _process_single_axis
|
62
|
+
|
63
|
+
axis.update_units(data)
|
64
|
+
|
65
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/axis.py", line 1466, in update_units
|
66
|
+
|
67
|
+
default = self.converter.default_units(data, self)
|
68
|
+
|
69
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/category.py", line 107, in default_units
|
70
|
+
|
71
|
+
axis.set_units(UnitData(data))
|
72
|
+
|
73
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/category.py", line 176, in __init__
|
74
|
+
|
75
|
+
self.update(data)
|
76
|
+
|
77
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/category.py", line 211, in update
|
78
|
+
|
79
|
+
cbook._check_isinstance((str, bytes), value=val)
|
80
|
+
|
81
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/cbook/__init__.py", line 2251, in _check_isinstance
|
82
|
+
|
83
|
+
type_name(type(v))))
|
84
|
+
|
27
85
|
TypeError: 'value' must be an instance of str or bytes, not a float
|
28
86
|
|
87
|
+
(base) sandairisatokonoMacBook-Air:kivy sandairisatoko$ conda activate Kivy
|
88
|
+
|
89
|
+
(Kivy) sandairisatokonoMacBook-Air:kivy sandairisatoko$ /Users/sandairisatoko/opt/anaconda3/envs/Kivy/bin/python /Users/sandairisatoko/Desktop/kivy/image/vanalysis09.py
|
90
|
+
|
91
|
+
Traceback (most recent call last):
|
92
|
+
|
93
|
+
File "/Users/sandairisatoko/Desktop/kivy/image/vanalysis09.py", line 56, in <module>
|
94
|
+
|
95
|
+
ax.hist(X.iloc[:,i], bins=10, color='#000000')
|
96
|
+
|
97
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/__init__.py", line 1447, in inner
|
98
|
+
|
99
|
+
return func(ax, *map(sanitize_sequence, args), **kwargs)
|
100
|
+
|
101
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 6576, in hist
|
102
|
+
|
103
|
+
self._process_unit_info(xdata=x[0], kwargs=kwargs)
|
104
|
+
|
105
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 2189, in _process_unit_info
|
106
|
+
|
107
|
+
kwargs = _process_single_axis(xdata, self.xaxis, 'xunits', kwargs)
|
108
|
+
|
109
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 2172, in _process_single_axis
|
110
|
+
|
111
|
+
axis.update_units(data)
|
112
|
+
|
113
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/axis.py", line 1466, in update_units
|
114
|
+
|
115
|
+
default = self.converter.default_units(data, self)
|
116
|
+
|
117
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/category.py", line 107, in default_units
|
118
|
+
|
119
|
+
axis.set_units(UnitData(data))
|
120
|
+
|
121
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/category.py", line 176, in __init__
|
122
|
+
|
123
|
+
self.update(data)
|
124
|
+
|
125
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/category.py", line 211, in update
|
126
|
+
|
127
|
+
cbook._check_isinstance((str, bytes), value=val)
|
128
|
+
|
129
|
+
File "/Users/sandairisatoko/opt/anaconda3/envs/Kivy/lib/python3.6/site-packages/matplotlib/cbook/__init__.py", line 2251, in _check_isinstance
|
130
|
+
|
131
|
+
type_name(type(v))))
|
132
|
+
|
133
|
+
TypeError: 'value' must be an instance of str or bytes, not a float
|
134
|
+
|
135
|
+
(Kivy) sandairisatokonoMacBook-Air:kivy sandairisatoko$
|
136
|
+
|
29
137
|
|
30
138
|
|
31
139
|
### 該当のソースコード
|
3
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,176 +12,178 @@
|
|
12
12
|
|
13
13
|
### 発生している問題・エラーメッセージ
|
14
14
|
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
```
|
22
|
+
|
23
|
+
エラーメッセージ
|
24
|
+
|
25
|
+
```
|
26
|
+
|
15
27
|
TypeError: 'value' must be an instance of str or bytes, not a float
|
16
28
|
|
17
29
|
|
18
30
|
|
31
|
+
### 該当のソースコード
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
```ここに言語名を入力
|
38
|
+
|
39
|
+
ソースコード
|
40
|
+
|
41
|
+
#-*- coding: utf-8 -*-
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
# matplotlibで作図する練習06:いろいろな度数分布図を描く(複数グラフ)
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
# システム関係のコマンドライブラリ
|
50
|
+
|
51
|
+
import sys
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
# データベースライブラリ pandas
|
56
|
+
|
57
|
+
import pandas as pd
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
# 計算用のライブラリ numpy
|
66
|
+
|
67
|
+
import numpy as np
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
# 作図ライブラリ matplotlib
|
72
|
+
|
73
|
+
import matplotlib.pyplot as plt
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
# 日本語フォントを設定するためのライブラリ
|
78
|
+
|
79
|
+
from matplotlib.font_manager import FontProperties
|
80
|
+
|
81
|
+
fp = FontProperties(fname=r'./fonts/mplus-2p-black.ttf', size=10)
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
# figureオブジェクトを生成する
|
86
|
+
|
87
|
+
fig = plt.figure()
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
# データを読み込む
|
94
|
+
|
95
|
+
try:
|
96
|
+
|
97
|
+
ramen = pd.read_csv('./data/ramen.csv')
|
98
|
+
|
99
|
+
except:
|
100
|
+
|
101
|
+
print('Data File Read Error: Exit')
|
102
|
+
|
103
|
+
sys.exit()
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
# 前回の課題からの再利用:度数分布を作成する対象のみを抜き出したデータフレームをつくる
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
X = ramen.loc[:, ['Brand','Variety','Style','Country','Stars','Top Ten']]
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
# 作図用に日本語のラベルをつくる
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
ramen_vnames=['雰囲気','清潔さ','設備','場所','安全','スタッフ','値打ち感']
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
# figureを生成する:普通の棒グラフを使った度数分布
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
fig, axes = plt.subplots(3,3)
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
cmax = len(X.columns)
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
for i, ax in enumerate(axes.flat):
|
140
|
+
|
141
|
+
if i >= cmax:
|
142
|
+
|
143
|
+
break
|
144
|
+
|
145
|
+
else:
|
146
|
+
|
147
|
+
#sns.violinplot(X.iloc[:,i], showmedians=True, color='#ED7D31', ax=ax)
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
ax.hist(X.iloc[:,i], bins=10, color='#000000')
|
152
|
+
|
153
|
+
#ax.boxplot(X.iloc[:,i], showfliers=False, patch_artist=True, boxprops=dict(facecolor='#70AD47'))
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
ax.set_title(ramen_vnames[i], fontproperties=fp)
|
160
|
+
|
161
|
+
ax.set_xlabel('評定値', fontproperties=fp,color='#70AD47')
|
162
|
+
|
163
|
+
ax.set_ylabel('度数', fontproperties=fp, color='#70AD47')
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
# 余白を調整する
|
174
|
+
|
175
|
+
plt.subplots_adjust(wspace=0.6, hspace=1.0)
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
# 表示する
|
180
|
+
|
181
|
+
plt.show()
|
182
|
+
|
19
183
|
|
20
184
|
|
21
185
|
```
|
22
186
|
|
23
|
-
エラーメッセージ
|
24
|
-
|
25
|
-
```
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
### 該当のソースコード
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
```ここに言語名を入力
|
36
|
-
|
37
|
-
ソースコード
|
38
|
-
|
39
|
-
#-*- coding: utf-8 -*-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
# matplotlibで作図する練習06:いろいろな度数分布図を描く(複数グラフ)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
# システム関係のコマンドライブラリ
|
48
|
-
|
49
|
-
import sys
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
# データベースライブラリ pandas
|
54
|
-
|
55
|
-
import pandas as pd
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
# 計算用のライブラリ numpy
|
64
|
-
|
65
|
-
import numpy as np
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
# 作図ライブラリ matplotlib
|
70
|
-
|
71
|
-
import matplotlib.pyplot as plt
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
# 日本語フォントを設定するためのライブラリ
|
76
|
-
|
77
|
-
from matplotlib.font_manager import FontProperties
|
78
|
-
|
79
|
-
fp = FontProperties(fname=r'./fonts/mplus-2p-black.ttf', size=10)
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
# figureオブジェクトを生成する
|
84
|
-
|
85
|
-
fig = plt.figure()
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
# データを読み込む
|
92
|
-
|
93
|
-
try:
|
94
|
-
|
95
|
-
ramen = pd.read_csv('./data/ramen.csv')
|
96
|
-
|
97
|
-
except:
|
98
|
-
|
99
|
-
print('Data File Read Error: Exit')
|
100
|
-
|
101
|
-
sys.exit()
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
# 前回の課題からの再利用:度数分布を作成する対象のみを抜き出したデータフレームをつくる
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
X = ramen.loc[:, ['Brand','Variety','Style','Country','Stars','Top Ten']]
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
# 作図用に日本語のラベルをつくる
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
ramen_vnames=['雰囲気','清潔さ','設備','場所','安全','スタッフ','値打ち感']
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
# figureを生成する:普通の棒グラフを使った度数分布
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
fig, axes = plt.subplots(3,3)
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
cmax = len(X.columns)
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
for i, ax in enumerate(axes.flat):
|
138
|
-
|
139
|
-
if i >= cmax:
|
140
|
-
|
141
|
-
break
|
142
|
-
|
143
|
-
else:
|
144
|
-
|
145
|
-
#sns.violinplot(X.iloc[:,i], showmedians=True, color='#ED7D31', ax=ax)
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
ax.hist(X.iloc[:,i], bins=10, color='#000000')
|
150
|
-
|
151
|
-
#ax.boxplot(X.iloc[:,i], showfliers=False, patch_artist=True, boxprops=dict(facecolor='#70AD47'))
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
ax.set_title(ramen_vnames[i], fontproperties=fp)
|
158
|
-
|
159
|
-
ax.set_xlabel('評定値', fontproperties=fp,color='#70AD47')
|
160
|
-
|
161
|
-
ax.set_ylabel('度数', fontproperties=fp, color='#70AD47')
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
# 余白を調整する
|
172
|
-
|
173
|
-
plt.subplots_adjust(wspace=0.6, hspace=1.0)
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
# 表示する
|
178
|
-
|
179
|
-
plt.show()
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
```
|
184
|
-
|
185
187
|
|
186
188
|
|
187
189
|
### 試したこと
|
2
誤字
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
1
書式の改善
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
度数分布表の表示
|
1
|
+
csvファイルから度数分布表の表示したい
|
test
CHANGED
File without changes
|