回答編集履歴
1
answer
CHANGED
@@ -21,3 +21,10 @@
|
|
21
21
|
# 0 1 0 0.2 0.0 0.0 0.8
|
22
22
|
# 1 2 0 0.0 0.3 0.4 5.0
|
23
23
|
```
|
24
|
+
|
25
|
+
最大値の要素が1つだけであれば以下でも可。
|
26
|
+
```python
|
27
|
+
for col in df.loc[:,'1':'4'].columns:
|
28
|
+
df.loc[df.idxmax()[col], col] = 0
|
29
|
+
```
|
30
|
+
|