回答編集履歴
1
回答追記
test
CHANGED
@@ -23,3 +23,29 @@
|
|
23
23
|
print([idx, score.iloc[0], row['Group name'], row['Group member']])
|
24
24
|
|
25
25
|
```
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
---
|
30
|
+
|
31
|
+
**【仕様にあわせて修正】**
|
32
|
+
|
33
|
+
```Python
|
34
|
+
|
35
|
+
import pandas as pd
|
36
|
+
|
37
|
+
df = pd.read_csv('renshu2.csv', index_col='Name')
|
38
|
+
|
39
|
+
for idx, row in df.iterrows():
|
40
|
+
|
41
|
+
score = row['One':'Three'].sort_values(ascending=False)
|
42
|
+
|
43
|
+
if score.iloc[0] >= score.iloc[1] * 2:
|
44
|
+
|
45
|
+
# 'Group member'に idx を含んでる行を求める
|
46
|
+
|
47
|
+
target_row = df[df['Group member'].str.contains(idx)].iloc[0]
|
48
|
+
|
49
|
+
print([idx, score.iloc[0], target_row['Group name'], target_row['Group member']])
|
50
|
+
|
51
|
+
```
|