mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-18 08:53:42 +00:00
Deduplicate history dates for make_future_dataframe
This commit is contained in:
parent
6ec0a90a60
commit
fb6552137c
2 changed files with 2 additions and 2 deletions
|
|
@ -1148,7 +1148,7 @@ fit.prophet <- function(m, df, ...) {
|
||||||
if (nrow(history) < 2) {
|
if (nrow(history) < 2) {
|
||||||
stop("Dataframe has less than 2 non-NA rows.")
|
stop("Dataframe has less than 2 non-NA rows.")
|
||||||
}
|
}
|
||||||
m$history.dates <- sort(set_date(df$ds))
|
m$history.dates <- sort(set_date(unique(df$ds)))
|
||||||
|
|
||||||
out <- setup_dataframe(m, history, initialize_scales = TRUE)
|
out <- setup_dataframe(m, history, initialize_scales = TRUE)
|
||||||
history <- out$df
|
history <- out$df
|
||||||
|
|
|
||||||
|
|
@ -1106,7 +1106,7 @@ class Prophet(object):
|
||||||
history = df[df['y'].notnull()].copy()
|
history = df[df['y'].notnull()].copy()
|
||||||
if history.shape[0] < 2:
|
if history.shape[0] < 2:
|
||||||
raise ValueError('Dataframe has less than 2 non-NaN rows.')
|
raise ValueError('Dataframe has less than 2 non-NaN rows.')
|
||||||
self.history_dates = pd.to_datetime(df['ds']).sort_values()
|
self.history_dates = pd.to_datetime(df['ds'].unique()).sort_values()
|
||||||
|
|
||||||
history = self.setup_dataframe(history, initialize_scales=True)
|
history = self.setup_dataframe(history, initialize_scales=True)
|
||||||
self.history = history
|
self.history = history
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue