stinoco commited on
Commit
111b9fa
1 Parent(s): 1f8e940

changed labels

Browse files
Files changed (1) hide show
  1. 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} with price policy change'}).copy()
52
  df_future['Date'] = df_future['Date'].apply(lambda x: x.date())
53
- df_future[f'{serie} without policy change'] = values_0.rename(columns = {'ds': 'Date', 'yhat': serie})[serie]
54
- df_future['Diff'] = df_future[f'{serie} with price policy change'] - df_future[f'{serie} without policy change']
55
- df_future[f'{serie} with price policy change'] = df_future[f'{serie} with price policy change'].apply(lambda x: round(x, 4))
56
- df_future[f'{serie} without policy change'] = df_future[f'{serie} without policy change'].apply(lambda x: round(x, 4))
 
 
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