我目前具有以下时间序列,并且具有4度多项式作为我的最佳拟合线。如何计算正确的咖啡因数并对该系列应用指数函数?我的目标是获得某种类型的增长率。 p>
data2 = StringIO("""
date value
09-Oct-17 0.304
10-Nov-17 0.316
26-Nov-17 0.636
12-Dec-17 0.652
28-Dec-17 0.639
13-Jan-18 0.623
02-Mar-18 0.619
18-Mar-18 0.608
19-Apr-18 0.605
05-May-18 0.625
06-Jun-18 0.639
22-Jun-18 0.663
08-Jul-18 0.64
24-Jul-18 0.623
09-Aug-18 0.632
28-Oct-18 0.736
""")
df2 = pd.read_table(data2, delim_whitespace=True)
df2.loc[:, "date"] = pd.to_datetime(df2.loc[:, "date"], format="%d-%b-%y")
y_values2 = df2.loc[:, "value"]
x_values2 = np.linspace(0,1,len(df2.loc[:, "value"]))
poly_degree = 4
coeffs2 = np.polyfit(x_values2, y_values2, poly_degree)
poly_eqn2 = np.poly1d(coeffs2)
y_hat2 = poly_eqn2(x_values2)
plt.figure(figsize=(12,8))
plt.plot(df.loc[:, "date"], df.loc[:,"value"] ,"ro",color='green')
plt.plot(df.loc[:, "date"],y_hat)
plt.plot(df2.loc[:, "date"], df2.loc[:,"value"] ,"ro",color='red')
plt.plot(df2.loc[:, "date"],y_hat2)
plt.title('WSC-10-50')
plt.ylabel('NDVI')
plt.xlabel('Date')
plt.savefig("NDVI_plot.png")