diff --git a/doc/source/user_guide/timeseries.rst b/doc/source/user_guide/timeseries.rst index ecdfb3c565d33..37413722de96f 100644 --- a/doc/source/user_guide/timeseries.rst +++ b/doc/source/user_guide/timeseries.rst @@ -1468,11 +1468,16 @@ 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" "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: 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))