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.
1 parent 252aa6c commit 391fa86Copy full SHA for 391fa86
pandas/tseries/offsets.py
@@ -397,7 +397,9 @@ def apply(self, other):
397
if n < 0 and result.weekday() > 4:
398
n += 1
399
n -= 5 * k
400
-
+ if n == 0 and result.weekday() > 4:
401
+ n -= 1
402
+
403
while n != 0:
404
k = n // abs(n)
405
result = result + timedelta(k)
pandas/tseries/tests/test_offsets.py
@@ -317,6 +317,11 @@ def test_apply_large_n(self):
317
rs = st + off
318
xp = datetime(2011, 12, 26)
319
self.assertEqual(rs, xp)
320
321
+ off = BDay() * 10
322
+ rs = datetime(2014, 1, 5) + off # see #5890
323
+ xp = datetime(2014, 1, 17)
324
+ self.assertEqual(rs, xp)
325
326
def test_apply_corner(self):
327
self.assertRaises(TypeError, BDay().apply, BMonthEnd())
0 commit comments