Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Holidays are all zeros (pandas 1.1.0 breaks holidays) #1617

Closed
MAFiA303 opened this issue Aug 9, 2020 · 4 comments
Closed

Holidays are all zeros (pandas 1.1.0 breaks holidays) #1617

MAFiA303 opened this issue Aug 9, 2020 · 4 comments

Comments

@MAFiA303
Copy link

MAFiA303 commented Aug 9, 2020

suddently holidays disappeared and are all zeros.
I started a new code following the example on the website and the same problem appeared.
I cannot tell what the cause is . here is the code:

df = pd.read_csv('/Users/saad/Desktop/peyton_example.csv')

playoffs = pd.DataFrame({
  'holiday': 'playoff',
  'ds': pd.to_datetime(['2008-01-13', '2009-01-03', '2010-01-16',
                        '2010-01-24', '2010-02-07', '2011-01-08',
                        '2013-01-12', '2014-01-12', '2014-01-19',
                        '2014-02-02', '2015-01-11', '2016-01-17',
                        '2016-01-24', '2016-02-07']),
  'lower_window': 0,
  'upper_window': 1,
})
superbowls = pd.DataFrame({
  'holiday': 'superbowl',
  'ds': pd.to_datetime(['2010-02-07', '2014-02-02', '2016-02-07']),
  'lower_window': 0,
  'upper_window': 1,
})
holidays = pd.concat((playoffs, superbowls))

m = Prophet(holidays=holidays)
forecast = m.fit(df).predict(future)


## optional
m.add_country_holidays(country_name='US')



@gentnm
Copy link

gentnm commented Aug 9, 2020

Duplicate of #1607 .
This is an issue with pandas 1.1.0. Downgrade pandas to a version <1.1.0 (e.g. 1.0.5) and it should work again.

@collinsuzebu
Copy link

@gentnm Thank you for this. Had same problem on a new machine but working well on another.

@bletham bletham changed the title Holidays are all zeros Holidays are all zeros (pandas 1.1.0 breaks holidays) Aug 14, 2020
@bletham bletham added the bug label Aug 14, 2020
@bletham
Copy link
Contributor

bletham commented Aug 14, 2020

Ok I just pushed a fix in 75ec9df . Old versions of pandas allow looking up a python date object in a pandas date index, but starting in pd 1.1.0 it seems you can only look up a pandas timestamp. We'll push this to pypi, but in the meantime the workaround is to downgrade pandas as described above.

@bletham
Copy link
Contributor

bletham commented Sep 3, 2020

This is now fixed in v0.7 that was just pushed to pypi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants