From c1021bdae06c4867f3f0882f95cc78f233e5fe2b Mon Sep 17 00:00:00 2001 From: Philipp Hoffmann Date: Wed, 20 Mar 2024 00:16:35 +0100 Subject: [PATCH 1/3] fix method docstrings --- pandas/tseries/holiday.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/tseries/holiday.py b/pandas/tseries/holiday.py index 50d0d33f0339f..cc9e2e3be8c38 100644 --- a/pandas/tseries/holiday.py +++ b/pandas/tseries/holiday.py @@ -108,7 +108,7 @@ def nearest_workday(dt: datetime) -> datetime: def next_workday(dt: datetime) -> datetime: """ - returns next weekday used for observances + returns next workday used for observances """ dt += timedelta(days=1) while dt.weekday() > 4: @@ -119,7 +119,7 @@ def next_workday(dt: datetime) -> datetime: def previous_workday(dt: datetime) -> datetime: """ - returns previous weekday used for observances + returns previous workday used for observances """ dt -= timedelta(days=1) while dt.weekday() > 4: @@ -130,7 +130,7 @@ def previous_workday(dt: datetime) -> datetime: def before_nearest_workday(dt: datetime) -> datetime: """ - returns previous workday after nearest workday + returns previous workday before nearest workday """ return previous_workday(nearest_workday(dt)) From 926666441b89a1e646f4b99f639fc1642c9cb5f3 Mon Sep 17 00:00:00 2001 From: Philipp Hoffmann Date: Wed, 20 Mar 2024 00:26:13 +0100 Subject: [PATCH 2/3] add observances to user guide --- doc/source/user_guide/timeseries.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/source/user_guide/timeseries.rst b/doc/source/user_guide/timeseries.rst index 0f38d90e18616..8ac8f9b11f978 100644 --- a/doc/source/user_guide/timeseries.rst +++ b/doc/source/user_guide/timeseries.rst @@ -1466,7 +1466,11 @@ or some other non-observed day. Defined observance rules are: :header: "Rule", "Description" :widths: 15, 70 + "next_workday", "move Saturday and Sunday to Monday" + "previous_workday", "move Saturday and Sunday to Friday" "nearest_workday", "move Saturday to Friday and Sunday to Monday" + "before_nearest_workday", "apply ``nearest_workday`` and then move to previous workday before that day" + "after_nearest_workday", "apply ``nearest_workday`` and then move to next workday after that day" "sunday_to_monday", "move Sunday to following Monday" "next_monday_or_tuesday", "move Saturday to Monday and Sunday/Monday to Tuesday" "previous_friday", move Saturday and Sunday to previous Friday" From 1bef52a9d2991984f9aa0eba9157e9974edeb5d0 Mon Sep 17 00:00:00 2001 From: Philipp Hoffmann Date: Wed, 20 Mar 2024 00:31:24 +0100 Subject: [PATCH 3/3] add weekend_to_monday to user guide --- doc/source/user_guide/timeseries.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/source/user_guide/timeseries.rst b/doc/source/user_guide/timeseries.rst index 8ac8f9b11f978..84049555d2c42 100644 --- a/doc/source/user_guide/timeseries.rst +++ b/doc/source/user_guide/timeseries.rst @@ -1475,6 +1475,7 @@ or some other non-observed day. Defined observance rules are: "next_monday_or_tuesday", "move Saturday to Monday and Sunday/Monday to Tuesday" "previous_friday", move Saturday and Sunday to previous Friday" "next_monday", "move Saturday and Sunday to following Monday" + "weekend_to_monday", "same as ``next_monday``" An example of how holidays and holiday calendars are defined: