使用Pandas数据框和Matplotlib生成平滑线

时间:2019-02-13 19:49:02

标签: python pandas matplotlib smoothing

我正在尝试使用包含时间(以天数为单位)和一组代表社会经济变量的数字的数据集生成一条平滑线。

以下是我的数据示例:

array1
    .concat(array2)
    .filter((v, i, a) => a.indexOf(v) === i)

到目前为止,这是我的代码:

date, data
726,1.2414
727,1.2414
728,1.2414
729,1.2414
730,1.2414
731,1.2414
732,1.2414
733,1.2414
734,1.2414
735,1.2414
736,1.2414
737,1.804597701
738,1.804597701
739,1.804597701
740,1.804597701
741,1.804597701
742,1.804597701
743,1.804597701
744,1.804597701
745,1.804597701
746,1.804597701
747,1.804597701
748,1.804597701
749,1.804597701
750,1.804597701
751,1.804597701
752,1.793103448
753,1.793103448
754,1.793103448
755,1.793103448
756,1.793103448
757,1.793103448
758,1.793103448
759,1.793103448
760,1.793103448
761,1.793103448
762,1.793103448
763,1.793103448
764,1
765,1 

这将生成以下图:

Test plot

我看到过一些帖子可以回答类似的问题(例如下面的问题),但是似乎无法使我的代码正常工作。谁能建议一个优雅的解决方案?

Generating smooth line graph using matplotlib

Python Matplotlib - Smooth plot line for x-axis with date values

0 个答案:

没有答案