MAPE = [mape(df['Price'][-500:], df['Predictions'][-500:]),
mape(df['Price'][-1000:-500], df['Predictions'][-1000:-500]),
mape(df['Price'][-1500:-1000], df['Predictions'][-1500:-1000]),
mape(df['Price'][-2000:-1500], df['Predictions'][-2000:-1500])]
Col1 = [ratios(15, i, i-500) for i in range(500, 2001, 500)]
Col2 = [ratios(10, i, i-500) for i in range(500, 2001, 500)]
Col3 = [ratios(5, i, i-500) for i in range(500, 2001, 500)]
print pd.DataFrame([MAPE, Col1, Col2, Col3],
index=["Mape", "Ratio 15%", "Ratio 10%", "Ratio 5%"],
columns=['0-500', "500-1000", "1000-1500", "1500-2000"])
Comments