1 Star 1 Fork 0

far/LSTM_GoogleClusterTraceData

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
deseasonalData.py 1.09 KB
一键复制 编辑 原始数据 按行查看 历史
thangbk2209 提交于 2017-11-21 22:18 . fix structure to check code
import numpy as np
import pandas as pd
from pandas import Series
from matplotlib import pyplot
from statsmodels.tsa.seasonal import seasonal_decompose
dateparse = lambda dates: pd.datetime.strptime(dates, '%Y-%m')
data = pd.read_csv('international-airline-passengers.csv', parse_dates='Month', index_col='Month',date_parser=dateparse, infer_datetime_format=True)
# dat = Series.from_csv('data/international-airline-passengers.csv')
# print len(dat)
# date_range = pd.date_range(dat.index.min(),dat.index.max(),freq="Month")
print data
result = seasonal_decompose(data.values, model='additive',freq=12)
print result
trend = result.trend
seasonal = result.seasonal
resid = result.resid
print trend
print len(seasonal)
print resid
# arr = np.array(result.resid)
residDf = pd.DataFrame(np.array(resid))
residDf.to_csv('data/residair.csv', index=False, header=None)
trendDf = pd.DataFrame(np.array(trend))
trendDf.to_csv('data/trendair.csv', index=False, header=None)
seasonalDf = pd.DataFrame(np.array(seasonal))
seasonalDf.to_csv('data/seasonalair.csv', index=False, header=None)
# print arr
result.plot()
pyplot.show()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/littlefar/LSTM_GoogleClusterTraceData.git
git@gitee.com:littlefar/LSTM_GoogleClusterTraceData.git
littlefar
LSTM_GoogleClusterTraceData
LSTM_GoogleClusterTraceData
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385