rsheftel / pandas_market_calendars

Exchange calendars to use with pandas for trading applications
MIT License
803 stars 173 forks source link

Schedule error when the date range is wide #160

Closed lyhuyen closed 2 years ago

lyhuyen commented 2 years ago

I'm currently working with pandas_market_calendars 3.2 Starting out with NYSE calendar:

import pandas_market_calendars as mcal nyse = mcal.get_calendar('NYSE')

This line runs fine: nyse.schedule('2021-04-30', '2021-05-15')

But this line returns error: nyse.schedule('2020-04-30', '2021-05-15') The error is ValueError: The dtype of 'values' is incorrect. Must be 'datetime64[ns]'. Got object instead. Basically, if the date range is longer than a couple of months, there is always an error. I had no issue with the older version of pandas_market_calendar (most likely 1.6 or so).

Any help is much appreciated.

glossner commented 2 years ago

This is not reproducible under Ubuntu 20.04 for the current main branch with pandas 1.3.3 and numpy 1.21.2

Try updating Pandas or post your pip freeze or conda list output.

lyhuyen commented 2 years ago

Updated to pandas 1.3.2 from pandas 1.1.3, This is no longer an issue. Thank you