【问题标题】:No numeric types to aggregate?没有要聚合的数字类型?
【发布时间】:2021-08-07 12:24:50
【问题描述】:

我正在尝试使用 groupby 计算不同列的平均值。 Here is my code.

但是,一旦我尝试计算平均值,就会出现错误 'no numeric types to aggregate'。我的代码有什么问题?请帮我!!!非常感谢。

【问题讨论】:

  • 将您的代码发布为文本而不是图像,以便人们可以更好地帮助您。

标签: python pandas-groupby aggregate mean numeric


【解决方案1】:

您能否将您的代码发布为文本和一些示例数据? data['low_stress']data['high_stress']的内容是什么?

我的猜测是,您使用pd.Series([low_stress]) 从而实例化一系列数据数组。使用pd.Series(low_stress) 可能会解决您的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-22
    • 2017-01-06
    • 2020-04-02
    • 2019-06-23
    • 1970-01-01
    • 1970-01-01
    • 2012-10-02
    • 2020-04-15
    相关资源
    最近更新 更多