File tree Expand file tree Collapse file tree 4 files changed +24
-3
lines changed
Expand file tree Collapse file tree 4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -413,6 +413,9 @@ Other
413413- Bug in :meth: `Series.diff ` where a boolean series would incorrectly raise a ``TypeError `` (:issue: `17294 `)
414414- :meth: `Series.append ` will no longer raise a ``TypeError `` when passed a tuple of ``Series `` (:issue: `28410 `)
415415- 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+
416419
417420.. _whatsnew_1000.contributors :
418421
Original file line number Diff line number Diff line change @@ -784,7 +784,8 @@ def test_categorical_no_compress():
784784
785785def test_sort ():
786786
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
788789 # This should result in a properly sorted Series so that the plot
789790 # has a sorted x axis
790791 # self.cat.groupby(['value_group'])['value_group'].count().plot(kind='bar')
Original file line number Diff line number Diff line change 22
33import pytest
44
5- from pandas import DatetimeIndex
5+ from pandas import DatetimeIndex , offsets , to_datetime
66import pandas .util .testing as tm
77
88from pandas .tseries .holiday import (
99 AbstractHolidayCalendar ,
1010 Holiday ,
1111 Timestamp ,
1212 USFederalHolidayCalendar ,
13+ USLaborDay ,
1314 USThanksgivingDay ,
1415 get_calendar ,
1516)
@@ -81,3 +82,19 @@ def test_calendar_observance_dates():
8182def test_rule_from_name ():
8283 us_fed_cal = get_calendar ("USFederalHolidayCalendar" )
8384 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):
346346
347347 rules = [] # type: List[Holiday]
348348 start_date = Timestamp (datetime (1970 , 1 , 1 ))
349- end_date = Timestamp (datetime (2030 , 12 , 31 ))
349+ end_date = Timestamp (datetime (2200 , 12 , 31 ))
350350 _cache = None
351351
352352 def __init__ (self , name = None , rules = None ):
You can’t perform that action at this time.
0 commit comments