file['Date']=[d.date() for d in file['DateTime']]#add the date collumn
DFList = []
for group in file.groupby(file['Date']):#split the dataframe according to the date
DFList.append(group[1])
len(DFList)
testMA = DFList[0]['Close'].rolling(window=5).mean()[4:]#get the moving average by using the rolling method of pandas
print(len(testMA))
print(len(DFList[0]['Close']))
Comments
Post a Comment