Spaces:
Runtime error
Runtime error
changed labels
Browse files- get_forecast.py +7 -5
get_forecast.py
CHANGED
@@ -48,12 +48,14 @@ def get_forecast(serie: str, periods, percent_change: int):
|
|
48 |
aux_0 = pd.concat([last_obs, values_0])
|
49 |
|
50 |
# arrange dataframe
|
51 |
-
df_future = future_values.rename(columns = {'ds': 'Date', 'yhat': f'{serie}
|
52 |
df_future['Date'] = df_future['Date'].apply(lambda x: x.date())
|
53 |
-
df_future[f'{serie}
|
54 |
-
df_future['Diff'] = df_future[f'{serie}
|
55 |
-
|
56 |
-
|
|
|
|
|
57 |
df_future['Diff'] = df_future['Diff'].apply(lambda x: round(x, 4))
|
58 |
|
59 |
# plot
|
|
|
48 |
aux_0 = pd.concat([last_obs, values_0])
|
49 |
|
50 |
# arrange dataframe
|
51 |
+
df_future = future_values.rename(columns = {'ds': 'Date', 'yhat': f'{serie} changing prices'}).copy()
|
52 |
df_future['Date'] = df_future['Date'].apply(lambda x: x.date())
|
53 |
+
df_future[f'{serie} holding prices'] = values_0.rename(columns = {'ds': 'Date', 'yhat': serie})[serie]
|
54 |
+
df_future['Diff'] = df_future[f'{serie} changing prices'] - df_future[f'{serie} holding prices']
|
55 |
+
|
56 |
+
# round values to 4 decimals
|
57 |
+
df_future[f'{serie} changing prices'] = df_future[f'{serie} changing prices'].apply(lambda x: round(x, 4))
|
58 |
+
df_future[f'{serie} holding prices'] = df_future[f'{serie} holding prices'].apply(lambda x: round(x, 4))
|
59 |
df_future['Diff'] = df_future['Diff'].apply(lambda x: round(x, 4))
|
60 |
|
61 |
# plot
|