I seem to be struggling with the following error while working through the ELP project and the video. I have played around with removing the “closed=‘left’” parameter, but that skews all of the data 1 week. Any input would be greatly appreciated.
def rolling_averages(group, cols, new_cols):
group = group.sort_values(“date”)
rolling_stats = group[cols].rolling(3, closed=‘left’).mean()
group[new_cols] = rolling_stats
group = group.dropna(subset=new_cols)
return group
ValueError: closed only implemented for datetimelike and offset based windows
Portfolio Project_ Predicting EPL Football Match Winners With Machine Learning.tar (373.5 KB)
Basics.ipynb (117.6 KB)