TypeError:使用statsmodel中的Season_decompose时ufunc'isfinite'

时间:2019-04-17 13:48:47

标签: python numpy statsmodels

使用每周导入数据,我试图使用Seasonal_decompose分析某些数据,但出现以下错误:如果不是np.all(np.isfinite(x)):

TypeError:输入类型不支持ufunc'isfinite',并且根据强制转换规则“ safe”,不能将输入安全地强制转换为任何受支持的类型

import pandas as pd
from matplotlib import pyplot as plt
import datetime as dt
import numpy as np
from statsmodels.tsa.seasonal import seasonal_decompose



PADD2_imports = pd.read_csv('PADD 2 Imports.csv')


PADD2_imports['Date'] = pd.to_datetime(PADD2_imports['Date'])
PADD2_imports['KBD Imports'] = PADD2_imports['KBD Imports'].astype(float)


decomposition = seasonal_decompose(PADD2_imports, model='additive', freq=52).plot()

这是我收到的错误:

if not np.all(np.isfinite(x)):

TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

0 个答案:

没有答案