diff --git a/python/fbprophet/forecaster.py b/python/fbprophet/forecaster.py index 154be29..3fbb696 100644 --- a/python/fbprophet/forecaster.py +++ b/python/fbprophet/forecaster.py @@ -311,7 +311,8 @@ class Prophet(object): # Holds columns of our future matrix. expanded_holidays = defaultdict(lambda: np.zeros(dates.shape[0])) # Makes an index so we can perform `get_loc` below. - row_index = pd.DatetimeIndex(dates) + # Strip to just dates. + row_index = pd.DatetimeIndex(dates.apply(lambda x:x.date())) for _ix, row in self.holidays.iterrows(): dt = row.ds.date() diff --git a/python/fbprophet/tests/test_prophet.py b/python/fbprophet/tests/test_prophet.py index 879e6fc..6d15efe 100644 --- a/python/fbprophet/tests/test_prophet.py +++ b/python/fbprophet/tests/test_prophet.py @@ -326,3 +326,13 @@ class TestProphet(TestCase): m = Prophet() m.fit(DATA) self.assertNotIn('daily', m.seasonalities) + + def test_subdaily_holidays(self): + holidays = pd.DataFrame({ + 'ds': pd.to_datetime(['2017-01-02']), + 'holiday': ['new_years'], + }) + m = Prophet(holidays=holidays) + m.fit(DATA2) + fcst = m.predict() + self.assertEqual(sum(fcst['new_years'] == 0), 575)