使用 Plotly Lineplot 绘制的每日数据点 – 平滑数据

社会演员多 python 261

原文标题Daily Datapoints plotted with Plotly Lineplot – Smoothing the data

这是从 12-08-2020 到 22-04-2022 的数据,每天都有数据点。Data

这是我的情节目前的样子:Current Plot

我现在真正想要的是,它只会绘制整条线的平均值。但我似乎找不到任何东西。我尝试使用关键字line_shape=spline但它并没有让它看起来更好。我目前使用这个:fig = px.line(x=count_by_day['creation_date'], y=count_by_day['count'], line_shape='spline')

原文链接:https://stackoverflow.com//questions/71962354/daily-datapoints-plotted-with-plotly-lineplot-smoothing-the-data

回复

我来回复
  • Pasgru的头像
    Pasgru 评论

    好的,我使用 7 天滚动平均值解决了这个问题

    count_by_day['count'] = count_by_day['count'].rolling(window=7).mean()
    

    看起来正是我想要的:enter image description here

    2年前 0条评论