Skip to content

Commit

Permalink
fix: sort values infer freq
Browse files Browse the repository at this point in the history
  • Loading branch information
AzulGarza committed Dec 9, 2023
1 parent 4b80613 commit a611d73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nbs/timegpt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
" if self.freq is None or self.freq in special_freqs:\n",
" unique_id = df.iloc[0]['unique_id']\n",
" df_id = df.query('unique_id == @unique_id')\n",
" inferred_freq = pd.infer_freq(df_id['ds'])\n",
" inferred_freq = pd.infer_freq(df_id['ds'].sort_values())\n",
" if inferred_freq is None:\n",
" raise Exception(\n",
" 'Could not infer frequency of ds column. This could be due to '\n",
Expand Down
2 changes: 1 addition & 1 deletion nixtlats/timegpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def infer_freq(self, df: pd.DataFrame):
if self.freq is None or self.freq in special_freqs:
unique_id = df.iloc[0]["unique_id"]
df_id = df.query("unique_id == @unique_id")
inferred_freq = pd.infer_freq(df_id["ds"])
inferred_freq = pd.infer_freq(df_id["ds"].sort_values())
if inferred_freq is None:
raise Exception(
"Could not infer frequency of ds column. This could be due to "
Expand Down

0 comments on commit a611d73

Please sign in to comment.