diff --git a/doc/source/whatsnew/v1.4.0.rst b/doc/source/whatsnew/v1.4.0.rst index 50156d4565bbd..ec0a4a3204601 100644 --- a/doc/source/whatsnew/v1.4.0.rst +++ b/doc/source/whatsnew/v1.4.0.rst @@ -214,6 +214,8 @@ Other enhancements - :meth:`Timestamp.isoformat`, now handles the ``timespec`` argument from the base :class:``datetime`` class (:issue:`26131`) - :meth:`NaT.to_numpy` ``dtype`` argument is now respected, so ``np.timedelta64`` can be returned (:issue:`44460`) - New option ``display.max_dir_items`` customizes the number of columns added to :meth:`Dataframe.__dir__` and suggested for tab completion (:issue:`37996`) +- Added "Juneteenth National Independence Day" to + ``USFederalHolidayCalendar``. See also `Other API changes`_. - :meth:`.Rolling.var`, :meth:`.Expanding.var`, :meth:`.Rolling.std`, :meth:`.Expanding.std` now support `Numba `_ execution with the ``engine`` keyword (:issue:`44461`) @@ -402,6 +404,18 @@ Other API changes - :meth:`Index.get_indexer_for` no longer accepts keyword arguments (other than 'target'); in the past these would be silently ignored if the index was not unique (:issue:`42310`) - Change in the position of the ``min_rows`` argument in :meth:`DataFrame.to_string` due to change in the docstring (:issue:`44304`) - Reduction operations for :class:`DataFrame` or :class:`Series` now raising a ``ValueError`` when ``None`` is passed for ``skipna`` (:issue:`44178`) +- Changed the ``name`` attribute of several holidays in + ``USFederalHolidayCalendar`` to match `official federal holiday + names `_ + specifically: + + - "New Year's Day" gains the possessive apostrophe + - "Presidents Day" becomes "Washington's Birthday" + - "Martin Luther King Jr. Day" is now "Birthday of Martin Luther King, Jr." + - "July 4th" is now "Independence Day" + - "Thanksgiving" is now "Thanksgiving Day" + - "Christmas" is now "Christmas Day" + - Added "Juneteenth National Independence Day" - .. --------------------------------------------------------------------------- diff --git a/pandas/tests/tseries/holiday/test_calendar.py b/pandas/tests/tseries/holiday/test_calendar.py index d9f54d9d80b2e..a1e3c1985a4d4 100644 --- a/pandas/tests/tseries/holiday/test_calendar.py +++ b/pandas/tests/tseries/holiday/test_calendar.py @@ -85,7 +85,7 @@ def test_calendar_observance_dates(): def test_rule_from_name(): us_fed_cal = get_calendar("USFederalHolidayCalendar") - assert us_fed_cal.rule_from_name("Thanksgiving") == USThanksgivingDay + assert us_fed_cal.rule_from_name("Thanksgiving Day") == USThanksgivingDay def test_calendar_2031(): diff --git a/pandas/tests/tseries/holiday/test_holiday.py b/pandas/tests/tseries/holiday/test_holiday.py index 0fb1da777e357..8ed88d5593547 100644 --- a/pandas/tests/tseries/holiday/test_holiday.py +++ b/pandas/tests/tseries/holiday/test_holiday.py @@ -164,19 +164,23 @@ def test_holiday_dates(holiday, start_date, end_date, expected): (EasterMonday, "2015-04-06", "2015-04-06"), (EasterMonday, datetime(2015, 7, 1), []), (EasterMonday, "2015-04-05", []), - ("New Years Day", "2015-01-01", "2015-01-01"), - ("New Years Day", "2010-12-31", "2010-12-31"), - ("New Years Day", datetime(2015, 7, 1), []), - ("New Years Day", "2011-01-01", []), - ("July 4th", "2015-07-03", "2015-07-03"), - ("July 4th", datetime(2015, 7, 1), []), - ("July 4th", "2015-07-04", []), + ("New Year's Day", "2015-01-01", "2015-01-01"), + ("New Year's Day", "2010-12-31", "2010-12-31"), + ("New Year's Day", datetime(2015, 7, 1), []), + ("New Year's Day", "2011-01-01", []), + ("Independence Day", "2015-07-03", "2015-07-03"), + ("Independence Day", datetime(2015, 7, 1), []), + ("Independence Day", "2015-07-04", []), ("Veterans Day", "2012-11-12", "2012-11-12"), ("Veterans Day", datetime(2015, 7, 1), []), ("Veterans Day", "2012-11-11", []), - ("Christmas", "2011-12-26", "2011-12-26"), - ("Christmas", datetime(2015, 7, 1), []), - ("Christmas", "2011-12-25", []), + ("Christmas Day", "2011-12-26", "2011-12-26"), + ("Christmas Day", datetime(2015, 7, 1), []), + ("Christmas Day", "2011-12-25", []), + ("Juneteenth National Independence Day", "2020-06-19", []), + ("Juneteenth National Independence Day", "2021-06-18", "2021-06-18"), + ("Juneteenth National Independence Day", "2022-06-19", []), + ("Juneteenth National Independence Day", "2022-06-20", "2022-06-20"), ], ) def test_holidays_within_dates(holiday, start, expected): diff --git a/pandas/tseries/holiday.py b/pandas/tseries/holiday.py index 15de48c416476..0e3a3f3fb6c18 100644 --- a/pandas/tseries/holiday.py +++ b/pandas/tseries/holiday.py @@ -531,17 +531,17 @@ def merge(self, other, inplace=False): "Columbus Day", month=10, day=1, offset=DateOffset(weekday=MO(2)) ) USThanksgivingDay = Holiday( - "Thanksgiving", month=11, day=1, offset=DateOffset(weekday=TH(4)) + "Thanksgiving Day", month=11, day=1, offset=DateOffset(weekday=TH(4)) ) USMartinLutherKingJr = Holiday( - "Martin Luther King Jr. Day", + "Birthday of Martin Luther King, Jr.", start_date=datetime(1986, 1, 1), month=1, day=1, offset=DateOffset(weekday=MO(3)), ) USPresidentsDay = Holiday( - "Presidents Day", month=2, day=1, offset=DateOffset(weekday=MO(3)) + "Washington’s Birthday", month=2, day=1, offset=DateOffset(weekday=MO(3)) ) GoodFriday = Holiday("Good Friday", month=1, day=1, offset=[Easter(), Day(-2)]) @@ -556,16 +556,23 @@ class USFederalHolidayCalendar(AbstractHolidayCalendar): """ rules = [ - Holiday("New Years Day", month=1, day=1, observance=nearest_workday), + Holiday("New Year's Day", month=1, day=1, observance=nearest_workday), USMartinLutherKingJr, USPresidentsDay, USMemorialDay, - Holiday("July 4th", month=7, day=4, observance=nearest_workday), + Holiday( + "Juneteenth National Independence Day", + month=6, + day=19, + start_date="2021-06-18", + observance=nearest_workday, + ), + Holiday("Independence Day", month=7, day=4, observance=nearest_workday), USLaborDay, USColumbusDay, Holiday("Veterans Day", month=11, day=11, observance=nearest_workday), USThanksgivingDay, - Holiday("Christmas", month=12, day=25, observance=nearest_workday), + Holiday("Christmas Day", month=12, day=25, observance=nearest_workday), ]