【问题标题】:Is there an inbuilt method in python(pandas) which can simulate a single day from multiple dayspython(pandas)中是否有一个内置方法可以模拟多天中的一天
【发布时间】:2020-10-23 22:10:28
【问题描述】:

我有一个月的太阳辐射时间序列数据,时间步长为 15 分钟(从 6 月 1 日到 6 月 30 日)。我的目标是通过取每个时刻的平均值来模拟所有 30 天中的一天。例如,最初我在上午 11 点、上午 11.15 点、上午 11.45 点等有 30 个不同的值。我想平均这 30 个值,以便我分别在上午 11 点、上午 11.15 点、上午 11.45 点有一个值。

【问题讨论】:

  • 您能否在此处包含您的代码,以方便想要帮助您的人?

标签: python pandas time-series


【解决方案1】:

您可以提取分钟以通过它来分隔列:

data['Minutes15'] = data['Date'].apply(lambda x: int(x.minute/15) *15))
data.groupby('Minutes15').mean()

Date 是您的日期时间格式的日期列

【讨论】:

    猜你喜欢
    • 2017-12-23
    • 1970-01-01
    • 2013-11-17
    • 2016-12-28
    • 1970-01-01
    • 2017-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多