Skip to content

Commit

Permalink
BUG: Fix errors / warnings related to pandas 1.3.0 (#41)
Browse files Browse the repository at this point in the history
* Fix #40

* Fix ExchangeCalendar.__init__ pandas FutureWarning
  • Loading branch information
maread99 authored Jul 7, 2021
1 parent 306d99a commit a0b8a15
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion exchange_calendars/calendar_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

NANOSECONDS_PER_MINUTE = int(6e10)

NP_NAT = np.array([pd.NaT], dtype=np.int64)[0]
NP_NAT = pd.NaT.value

Session = typing.Union[pd.Timestamp, str, int, float, datetime.datetime]

Expand Down
16 changes: 12 additions & 4 deletions exchange_calendars/exchange_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,22 @@ def __init__(self, start=start_default, end=end_default):
_special_closes,
)

if self._break_starts is None:
break_starts = None
else:
break_starts = self._break_starts.tz_localize(None)
if self._break_ends is None:
break_ends = None
else:
break_ends = self._break_ends.tz_localize(None)
self.schedule = DataFrame(
index=_all_days,
data=OrderedDict(
[
("market_open", self._opens),
("break_start", self._break_starts),
("break_end", self._break_ends),
("market_close", self._closes),
("market_open", self._opens.tz_localize(None)),
("break_start", break_starts),
("break_end", break_ends),
("market_close", self._closes.tz_localize(None)),
]
),
dtype="datetime64[ns]",
Expand Down

0 comments on commit a0b8a15

Please sign in to comment.