回答編集履歴

1

2023/04/20 06:40

投稿

melian
melian

スコア19825

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