對我的評價,我想跑滾動1000窗口在這個網址找到該數據集的OLS regression estimation
:使用以下Python
腳本 https://drive.google.com/open?id=0B2Iv8dfU4fTUa3dPYW5tejA0bzg 。Python的大熊貓有沒有屬性醇 - 錯誤(滾動OLS)
# /usr/bin/python -tt
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from statsmodels.formula.api import ols
df = pd.read_csv('estimated.csv', names=('x','y'))
model = pd.stats.ols.MovingOLS(y=df.Y, x=df[['y']],
window_type='rolling', window=1000, intercept=True)
df['Y_hat'] = model.y_predict
然而,當我跑我的Python腳本,我收到此錯誤:AttributeError: module 'pandas.stats' has no attribute 'ols'
。這個錯誤可能來自我使用的版本嗎?安裝我的Linux節點上的pandas
有一個版本的0.20.2
用,會發生什麼'從pandas.stats導入ols'? – roganjosh
它說'ImportError:無法導入名稱'ols''。 –
你用'print(dir(pd.stats))'得到了什麼?我不在筆記本電腦上,很快就會回家測試自己。它在列表中嗎? – roganjosh