File tree 4 files changed +24
-3
lines changed
4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -413,6 +413,9 @@ Other
413
413
- Bug in :meth: `Series.diff ` where a boolean series would incorrectly raise a ``TypeError `` (:issue: `17294 `)
414
414
- :meth: `Series.append ` will no longer raise a ``TypeError `` when passed a tuple of ``Series `` (:issue: `28410 `)
415
415
- Fix corrupted error message when calling ``pandas.libs._json.encode() `` on a 0d array (:issue: `18878 `)
416
+ - Fix :class: `AbstractHolidayCalendar ` to return correct results for
417
+ years after 2030 (now goes up to 2200) (:issue: `27790 `)
418
+
416
419
417
420
.. _whatsnew_1000.contributors :
418
421
Original file line number Diff line number Diff line change @@ -784,7 +784,8 @@ def test_categorical_no_compress():
784
784
785
785
def test_sort ():
786
786
787
- # http://stackoverflow.com/questions/23814368/sorting-pandas-categorical-labels-after-groupby # noqa: E501
787
+ # http://stackoverflow.com/questions/23814368/sorting-pandas-
788
+ # categorical-labels-after-groupby
788
789
# This should result in a properly sorted Series so that the plot
789
790
# has a sorted x axis
790
791
# self.cat.groupby(['value_group'])['value_group'].count().plot(kind='bar')
Original file line number Diff line number Diff line change 2
2
3
3
import pytest
4
4
5
- from pandas import DatetimeIndex
5
+ from pandas import DatetimeIndex , offsets , to_datetime
6
6
import pandas .util .testing as tm
7
7
8
8
from pandas .tseries .holiday import (
9
9
AbstractHolidayCalendar ,
10
10
Holiday ,
11
11
Timestamp ,
12
12
USFederalHolidayCalendar ,
13
+ USLaborDay ,
13
14
USThanksgivingDay ,
14
15
get_calendar ,
15
16
)
@@ -81,3 +82,19 @@ def test_calendar_observance_dates():
81
82
def test_rule_from_name ():
82
83
us_fed_cal = get_calendar ("USFederalHolidayCalendar" )
83
84
assert us_fed_cal .rule_from_name ("Thanksgiving" ) == USThanksgivingDay
85
+
86
+
87
+ def test_calendar_2031 ():
88
+ # See gh-27790
89
+ #
90
+ # Labor Day 2031 is on September 1. Saturday before is August 30.
91
+ # Next working day after August 30 ought to be Tuesday, September 2.
92
+
93
+ class testCalendar (AbstractHolidayCalendar ):
94
+ rules = [USLaborDay ]
95
+
96
+ cal = testCalendar ()
97
+ workDay = offsets .CustomBusinessDay (calendar = cal )
98
+ Sat_before_Labor_Day_2031 = to_datetime ("2031-08-30" )
99
+ next_working_day = Sat_before_Labor_Day_2031 + 0 * workDay
100
+ assert next_working_day == to_datetime ("2031-09-02" )
Original file line number Diff line number Diff line change @@ -346,7 +346,7 @@ class AbstractHolidayCalendar(metaclass=HolidayCalendarMetaClass):
346
346
347
347
rules = [] # type: List[Holiday]
348
348
start_date = Timestamp (datetime (1970 , 1 , 1 ))
349
- end_date = Timestamp (datetime (2030 , 12 , 31 ))
349
+ end_date = Timestamp (datetime (2200 , 12 , 31 ))
350
350
_cache = None
351
351
352
352
def __init__ (self , name = None , rules = None ):
You can’t perform that action at this time.
0 commit comments