Closed
Description
This issue is closely related to bug #2680 and I believe it is also a bug.
The problem appears when adding a number of BDay n with n > 5, n % 5 == 0 to
a starting date which is not on offset.
For instance
dt = Timestamp('20140105') # Sunday
print (dt + BDay(10)).strftime('%A')
Sunday
We except Friday and not Sunday. Likewise, Friday is 'gone' from the week in the following loop:
for i in range(8,12):
print i, (Timestamp('20140104') + BDay(i)).strftime('%A')
8 Wednesday
9 Thursday
10 Saturday
11 Monday
It does yield the correct results for substraction however:
for i in range(9,13):
print i, (Timestamp('20140105') - BDay(i)).strftime('%A')
9 Tuesday
10 Monday
11 Friday
12 Thursday
I have patched tseries/offsets.py with a couple of lines and it corrects the problem without apparently breaking any of the existing tests (version 0.13.0-94-g0bab303). I am not super familiar with git but can try to write a PR about this if appropriate.