Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -67,7 +67,15 @@ def generate_forecast(model, df,tag=False):
|
|
67 |
def determine_frequency(df):
|
68 |
df['ds'] = pd.to_datetime(df['ds'])
|
69 |
df = df.set_index('ds')
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
return freq
|
72 |
|
73 |
def plot_forecasts(forecast_df, train_df, title):
|
|
|
67 |
def determine_frequency(df):
|
68 |
df['ds'] = pd.to_datetime(df['ds'])
|
69 |
df = df.set_index('ds')
|
70 |
+
|
71 |
+
# Create a complete date range
|
72 |
+
full_range = pd.date_range(start=df.index.min(), end=df.index.max())
|
73 |
+
|
74 |
+
# Reindex the DataFrame to this full date range
|
75 |
+
df_full = df.reindex(full_range)
|
76 |
+
|
77 |
+
# Infer the frequency
|
78 |
+
freq = pd.infer_freq(df_full.index)
|
79 |
return freq
|
80 |
|
81 |
def plot_forecasts(forecast_df, train_df, title):
|