Hello I have this python code which calculates a trendline based on two pivots and then extrapolates it into the future. I wonder how do I get a vector of extrapolated trendline values (in a list) - say from 1000 to 1050? I need this vector to operate on it. So far I can only plot these values.
import numpy as np
import matplotlib.pyplot as plt
y = np.array([13.6700,14.4900])
x = np.array([992,1000])
x2=np.array([1001,1010])
p = np.polyfit(x, y, 1)
f = np.poly1d(p)
plt.plot(x, y, 'bo', label="Data")
plt.plot(x,f(x), 'r:',label="Polyfit")
plt.plot(x2,f(x2), 'b-',label="Polyfit")
print(p)
print(f(x2))
f(1010)