Getting TypeError: reduction operation 'argmax' not allowed for this dtype when trying to use idxmax()

前端 未结 4 1547
[愿得一人]
[愿得一人] 2021-01-07 22:34

When using the idxmax() function in Pandas, I keep receiving this error.

Traceback (most recent call last):
  File \"/Users/username/College/yea         


        
4条回答
  •  太阳男子
    2021-01-07 23:25

    In short, try this

    best_c = results_table.loc[results_table['Mean recall score'].astype(float).idxmax()]['C_parameter']
    

    instead of

    best_c = results_table.loc[results_table['Mean recall score'].idxmax()]['C_parameter']
    

提交回复
热议问题