kashif HF staff commited on
Commit
d7202b3
1 Parent(s): e460697

reindex the df as well

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -48,7 +48,9 @@ def train_and_forecast(
48
  gluon_df = PandasDataset(df, target=df.columns[0])
49
  except TypeError:
50
  freq = pd.infer_freq(df.index[:3])
51
- gluon_df = PandasDataset(df, target=df.columns[0], freq=freq)
 
 
52
 
53
  training_data, test_gen = split(gluon_df, offset=row_offset)
54
 
 
48
  gluon_df = PandasDataset(df, target=df.columns[0])
49
  except TypeError:
50
  freq = pd.infer_freq(df.index[:3])
51
+ date_range = pd.date_range(df.index[0], df.index[-1], freq=freq)
52
+ new_df = df.reindex(date_range)
53
+ gluon_df = PandasDataset(new_df, target=new_df.columns[0], freq=freq)
54
 
55
  training_data, test_gen = split(gluon_df, offset=row_offset)
56