簡體   English   中英

如何將這三列 dataframe 轉換為一列,該列的值在一行中的最大值

[英]how can I transform this three column dataframe to a one column with the value of the column in the highest value in a row

如何將這三列 dataframe 轉換為一列,該列的值在一行中的最大值。 例如,第一行變為 -1,第二行變為 1。

dataframe概述:-

在此處輸入圖像描述

idxmax是您要找的

df["max"] = df.idxmax(axis=1)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM