We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
from trading_calendars import get_calendar get_calendar('CME')
Raises TypeError: data is already tz-aware UTC, unable to set specified tz: UTC.
TypeError: data is already tz-aware UTC, unable to set specified tz: UTC
This is a result of this issue in pandas where 'UTC' and pytz.UTC are not considered equal (I'm seeing this in pandas version 0.24.0).
'UTC'
pytz.UTC
pandas
0.24.0
I believe the fix would be to change the return in trading_calendars.trading_calendar.scheduled_special_times():
trading_calendars.trading_calendar.scheduled_special_times()
return pd.Series( index=pd.DatetimeIndex(days, tz='UTC'), data=days_at_time(days, time, tz=tz), )
to:
return pd.Series( index=pd.DatetimeIndex(days, tz=pytz.UTC), data=days_at_time(days, time, tz=tz), )
(Basically, replace 'UTC' with pytz.UTC when creating the index.)
The text was updated successfully, but these errors were encountered:
For now, monkey patching works:
import pytz import trading_calendars as tc def scheduled_special_times(calendar, start, end, time, tz): days = calendar.holidays(start, end) return pd.Series( index=pd.DatetimeIndex(days, tz=pytz.UTC), data=tc.trading_calendar.days_at_time(days, time, tz=tz), ) tc.trading_calendar.scheduled_special_times = scheduled_special_times tc.get_calendar('CME')
Sorry, something went wrong.
pytz
Successfully merging a pull request may close this issue.
Raises
TypeError: data is already tz-aware UTC, unable to set specified tz: UTC
.This is a result of this issue in pandas where
'UTC'
andpytz.UTC
are not considered equal (I'm seeing this inpandas
version0.24.0
).I believe the fix would be to change the return in
trading_calendars.trading_calendar.scheduled_special_times()
:to:
(Basically, replace
'UTC'
withpytz.UTC
when creating the index.)The text was updated successfully, but these errors were encountered: