【问题标题】:ValueError: Wrong number of items passed 2, placement implies 3ValueError:传递的项目数错误 2,位置暗示 3
【发布时间】:2021-07-05 23:02:29
【问题描述】:

enter image description here 你好,

  • 我正在尝试找出哪个大陆具有最大数据速率的答案。 max_data_rate_continent = df.groupby(['Data.Rate']).max()['Location.Continent']
    所以,它给了我这样的错误 ValueError: wrong number of items passed 2, placement implies 3

【问题讨论】:

    标签: python python-3.x pandas


    【解决方案1】:

    idxmaxdf.loc 一起使用:

    max_data_rate_continent = df.loc[df['Data.Rate'].idxmax(), 'Location.Continent']
    

    【讨论】:

    • - 非常感谢您的帮助,先生,它有效
    猜你喜欢
    • 2021-04-08
    • 2020-01-30
    • 2021-07-13
    • 2021-08-10
    • 2020-07-02
    • 1970-01-01
    • 2021-11-26
    • 2020-04-22
    • 2019-09-23
    相关资源
    最近更新 更多