I am trying to retrieve some stock data and calculates SMAs etc. Since the function rolling_mean has been deprecated in Pandas, I tried Series instead. However, I get an error message: ValueError: cannot copy sequence with size 6 to array axis with dimension 2165
Could anyone tell me what I do wrong?
Many thanks!
import numpy as np # array operations
import pandas as pd # time series management
from pandas_datareader import data as web # data retrieval
import matplotlib.pyplot as plt # standard plotting library
import seaborn as sns; sns.set() # nicer plotting style
import datetime
start = datetime.datetime(2010, 1, 1)
end = datetime.datetime(2018, 4, 19)
f = web.DataReader('F', 'morningstar', start, end)
print(f.tail)
f['SMA50'] = pd.rolling_mean(f['Close'], window=50) #OLD
f['SMA50'] = pd.Series(f).rolling(window=50).mean() #NEW