小编Mar*_*din的帖子

seasonal_decompose:操作数无法与系列中的形状一起广播

我知道这个话题有很多问题,但没有一个能帮助我解决这个问题.我真的坚持这个.

有一个简单的系列:

0
2016-01-31  266
2016-02-29  235
2016-03-31  347
2016-04-30  514
2016-05-31  374
2016-06-30  250
2016-07-31  441
2016-08-31  422
2016-09-30  323
2016-10-31  168
2016-11-30  496
2016-12-31  303

import statsmodels.api as sm
logdf = np.log(df[0])
decompose = sm.tsa.seasonal_decompose(logdf,freq=12, model='additive')
decomplot = decompose.plot()
Run Code Online (Sandbox Code Playgroud)

我一直在: ValueError: operands could not be broadcast together with shapes (12,) (14,)

我已经尝试了很多东西,只传递了logdf.values,传递了非日志系列.它不起作用.Numpy和statsmodel版本:

print(statsmodels.__version__)
print(pd.__version__)
print(np.__version__)
0.6.1
0.18.1
1.11.3
Run Code Online (Sandbox Code Playgroud)

numpy time-series decomposition pandas statsmodels

6
推荐指数
1
解决办法
2386
查看次数

标签 统计

decomposition ×1

numpy ×1

pandas ×1

statsmodels ×1

time-series ×1