You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For rolling back or for moving forward more than one step, DateOffsets create a new instance setting naccordingly. The CustomBusinessDay constructor can be very slow, however, when a large list of holidays is passed. The holidays are processed to datetime64.
As a result speed deteriorates by two magnitudes.
import pandas as pd
import datetime as dt
pd.__version__
Out[6]:
'0.14.1'
In [7]:
cbday = pd.offsets.CustomBusinessDay()
date + cbday
%timeit date + cbday
100000 loops, best of 3: 14.6 µs per loop
In [8]:
hdays = [dt.datetime(2013,1,1) for ele in range(1000)]
cbdayh = pd.offsets.CustomBusinessDay(holidays=hdays)
date + cbdayh
%timeit date + cbdayh
%timeit date + 2*cbdayh
%timeit date - 1*cbdayh
%timeit date - 10*cbday
100000 loops, best of 3: 14.6 µs per loop
100 loops, best of 3: 3.4 ms per loop
100 loops, best of 3: 6.76 ms per loop
10000 loops, best of 3: 27.8 µs per loop
I think it makes sense to have the user call to_dt64 before initializing CustomBusinessDay and to rely on the holidays to be passed in the correct format. Any other ideas how to handle this problem? Shall I create a PR for this?
The text was updated successfully, but these errors were encountered:
For rolling back or for moving forward more than one step,
DateOffset
s create a new instance settingn
accordingly. TheCustomBusinessDay
constructor can be very slow, however, when a large list ofholidays
is passed. The holidays are processed to datetime64.As a result speed deteriorates by two magnitudes.
I think it makes sense to have the user call
to_dt64
before initializingCustomBusinessDay
and to rely on the holidays to be passed in the correct format. Any other ideas how to handle this problem? Shall I create a PR for this?The text was updated successfully, but these errors were encountered: