回答編集履歴
1
Update
test
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
```python
|
2
|
-
df_per = df.groupby('Type')
|
2
|
+
df_per = df.groupby('Type')\
|
3
|
-
|
3
|
+
.apply(lambda x: len(x.query('-30 <= Score1 < 30 and 55 <= Score2 < 100'))/len(x))\
|
4
|
-
|
4
|
+
.to_frame('ratio')
|
5
|
-
index=['-30 <= Score1 < 30', '55 <= Score2 < 100']))
|
6
5
|
|
7
6
|
print(df_per)
|
8
7
|
|
9
8
|
#
|
10
|
-
|
9
|
+
ratio
|
11
|
-
Type
|
10
|
+
Type
|
12
|
-
CB
|
11
|
+
CB 0.18
|
13
|
-
CU
|
12
|
+
CU 0.14
|
14
|
-
FF
|
13
|
+
FF 0.20
|
15
|
-
SI
|
14
|
+
SI 0.19
|
16
|
-
SL
|
15
|
+
SL 0.20
|
17
|
-
SP
|
16
|
+
SP 0.18
|
18
17
|
```
|
19
18
|
|