質問編集履歴
4
冒頭の元データと出力データを実際にコードで読み込んだものに修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,39 +18,41 @@
|
|
18
18
|
|
19
19
|
Aクラス
|
20
20
|
|
21
|
-
ID
|
21
|
+
ID sex kg cm
|
22
22
|
|
23
23
|
1 男 34 134
|
24
24
|
|
25
|
-
2
|
25
|
+
2 男 46 121
|
26
26
|
|
27
|
-
3
|
27
|
+
3 男 54 110
|
28
28
|
|
29
|
-
4
|
29
|
+
4 男 23 126
|
30
30
|
|
31
|
-
5 女
|
31
|
+
5 女 75 164
|
32
32
|
|
33
|
-
6
|
33
|
+
6 女 34 131
|
34
34
|
|
35
|
-
7
|
35
|
+
7 女 44 121
|
36
36
|
|
37
|
-
8
|
37
|
+
8 女 55 151
|
38
38
|
|
39
|
-
|
39
|
+
|
40
40
|
|
41
41
|
|
42
42
|
|
43
43
|
<出力データ>ファイル名:Aクラス_身長
|
44
44
|
|
45
|
-
range
|
45
|
+
range cm
|
46
46
|
|
47
|
-
100-110
|
47
|
+
0 100-110 0
|
48
48
|
|
49
|
-
110-120
|
49
|
+
1 110-120 1
|
50
50
|
|
51
|
-
120-130
|
51
|
+
2 120-130 3
|
52
52
|
|
53
|
-
130-140
|
53
|
+
3 130-140 2
|
54
|
+
|
55
|
+
|
54
56
|
|
55
57
|
|
56
58
|
|
3
一つのファイルの出力はできた
test
CHANGED
File without changes
|
test
CHANGED
@@ -133,3 +133,51 @@
|
|
133
133
|
|
134
134
|
|
135
135
|
lists = [count_110, count_120, count_130, count_140]
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
◎追記3(何とか一つのファイルの出力はできました)
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
import pandas as pd
|
144
|
+
|
145
|
+
import glob
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
file = glob.glob('input/*.csv')
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
df = pd.read_csv("input/A.csv", header=3)
|
154
|
+
|
155
|
+
rannge_110 = (df.query('100 <= cm < 110'))
|
156
|
+
|
157
|
+
rannge_120 = (df.query('110 <= cm < 120'))
|
158
|
+
|
159
|
+
rannge_130 = (df.query('120 <= cm < 130'))
|
160
|
+
|
161
|
+
rannge_140 = (df.query('130 <= cm < 140'))
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
count_110 = (len(rannge_110))
|
166
|
+
|
167
|
+
count_120 = (len(rannge_120))
|
168
|
+
|
169
|
+
count_130 = (len(rannge_130))
|
170
|
+
|
171
|
+
count_140 = (len(rannge_140))
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
cm = [count_110, count_120, count_130, count_140]
|
176
|
+
|
177
|
+
range = ["110","120","130","140"]
|
178
|
+
|
179
|
+
dict = {'range': range,'cm': cm}
|
180
|
+
|
181
|
+
df2 = pd.DataFrame(dict)
|
182
|
+
|
183
|
+
df2.to_csv('A_output.csv')
|
2
追記で自分ができる限りのコードを記入②
test
CHANGED
File without changes
|
test
CHANGED
@@ -93,3 +93,43 @@
|
|
93
93
|
rannge_130 = (df.query('120 <= cm < 130'))
|
94
94
|
|
95
95
|
rannge_140 = (df.query('130 <= cm < 140'))
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
◎追記2
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
import pandas as pd
|
104
|
+
|
105
|
+
import glob
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
file = glob.glob('input/*.csv')
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
df = pd.read_csv("input/A.csv", header=3)
|
114
|
+
|
115
|
+
rannge_110 = (df.query('100 <= cm < 110'))
|
116
|
+
|
117
|
+
rannge_120 = (df.query('110 <= cm < 120'))
|
118
|
+
|
119
|
+
rannge_130 = (df.query('120 <= cm < 130'))
|
120
|
+
|
121
|
+
rannge_140 = (df.query('130 <= cm < 140'))
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
count_110 = (len(rannge_110))
|
126
|
+
|
127
|
+
count_120 = (len(rannge_120))
|
128
|
+
|
129
|
+
count_130 = (len(rannge_130))
|
130
|
+
|
131
|
+
count_140 = (len(rannge_140))
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
lists = [count_110, count_120, count_130, count_140]
|
1
追記で自分ができる限りのコードを記入
test
CHANGED
File without changes
|
test
CHANGED
@@ -73,3 +73,23 @@
|
|
73
73
|
何卒ご教授いただければ幸いです。
|
74
74
|
|
75
75
|
よろしくお願いいたします
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
◎追記
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
import pandas as pd
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
df = pd.read_csv("./A.csv",header=3)
|
88
|
+
|
89
|
+
rannge_110 = (df.query('100 <= cm < 110'))
|
90
|
+
|
91
|
+
rannge_120 = (df.query('110 <= cm < 120'))
|
92
|
+
|
93
|
+
rannge_130 = (df.query('120 <= cm < 130'))
|
94
|
+
|
95
|
+
rannge_140 = (df.query('130 <= cm < 140'))
|