Pandas:时间数据的季节分析

最近在做论文的数据处理,涉及到不同年份不同季节的分析。另外还要求不同季节的数据可以单独分析。

其实思路还是比较简单的,那就在原始数据中增加一栏:季节

2013-05-21  Aotizhongxin  124.3  Spring
2013-05-22 Aotizhongxin 85.7 Spring
2013-05-23 Aotizhongxin 71.2 Spring
2013-05-24 Aotizhongxin 75.6 Spring
2013-05-25 Aotizhongxin 95.5 Spring
2013-05-26 Aotizhongxin 93.4 Spring
... ... ... ...
2015-10-13 Zhonghuamen 75.6 Autumn
2015-10-14 Zhonghuamen 98.8 Autumn
2015-10-20 Zhonghuamen 48.3 Autumn
2015-10-21 Zhonghuamen 47.2 Autumn
2015-10-22 Zhonghuamen 70.5 Autumn
2015-10-23 Zhonghuamen 103.3 Autumn
2015-10-24 Zhonghuamen 78.6 Autumn

直接上相关的代码吧:

DF['Season'] = ""
for row in DF.index:
DF.Season[row] = SeasonDict[row.month]
DFWinter = DF[DF.Season == 'Winter']

剩下的就是根据自己的需求进行作图了。

#参考#

上一篇:Java反射机制——学习总结


下一篇:JAVA反射机制学习随笔