mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-07-30 20:18:11 +00:00
Fix holidays NA handling
This commit is contained in:
parent
2e9f831474
commit
f123a1a7cc
2 changed files with 6 additions and 3 deletions
|
|
@ -169,7 +169,7 @@ validate_inputs <- function(m) {
|
|||
stop('Holidays dataframe must have ds field.')
|
||||
}
|
||||
m$holidays$ds <- as.Date(m$holidays$ds)
|
||||
if (any(is.na(m$holidays))) {
|
||||
if (any(is.na(m$holidays$ds)) | any(is.na(m$holidays$holiday))) {
|
||||
stop('Found NA in the holidays dataframe.')
|
||||
}
|
||||
has.lower <- exists('lower_window', where = m$holidays)
|
||||
|
|
|
|||
|
|
@ -169,8 +169,11 @@ class Prophet(object):
|
|||
raise ValueError('holidays must be a DataFrame with "ds" and '
|
||||
'"holiday" columns.')
|
||||
self.holidays['ds'] = pd.to_datetime(self.holidays['ds'])
|
||||
if self.holidays.isnull().any().any():
|
||||
raise ValueError('Found a NaN in holidays dataframe')
|
||||
if (
|
||||
self.holidays['ds'].isnull().any()
|
||||
or self.holidays['holiday'].isnull().any()
|
||||
):
|
||||
raise ValueError('Found a NaN in holidays dataframe.')
|
||||
has_lower = 'lower_window' in self.holidays
|
||||
has_upper = 'upper_window' in self.holidays
|
||||
if has_lower + has_upper == 1:
|
||||
|
|
|
|||
Loading…
Reference in a new issue