Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -56,18 +56,18 @@ def train_and_forecast(
|
|
56 |
except AttributeError:
|
57 |
raise gr.Error("Upload a file with the Upload button")
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
#
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
print(df)
|
72 |
gluon_df = PandasDataset(df, target=df.columns[0])
|
73 |
print(gluon_df)
|
|
|
56 |
except AttributeError:
|
57 |
raise gr.Error("Upload a file with the Upload button")
|
58 |
|
59 |
+
freq = pd.infer_freq(df.index[:3])
|
60 |
+
print(freq)
|
61 |
+
date_range = pd.date_range(df.index[0], pd.DateOffset(months=prediction_length//2) + df.index[-1], freq=freq)
|
62 |
+
print(date_range)
|
63 |
+
new_df = df.reindex(date_range)
|
64 |
+
new_df = new_df.interpolate(method='spline', order=2)
|
65 |
+
# trying this hack to fix pandas beginMonth stuff
|
66 |
+
buffer = io.BytesIO()
|
67 |
+
new_df.to_csv(buffer, index=False)
|
68 |
+
buffer.seek(0)
|
69 |
+
df = pd.read_csv(buffer, index_col=0, parse_dates=True)
|
70 |
+
df.sort_index(inplace=True)
|
71 |
print(df)
|
72 |
gluon_df = PandasDataset(df, target=df.columns[0])
|
73 |
print(gluon_df)
|