Skip to content

DOC: Update holiday.py #60094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pandas/tseries/holiday.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
def next_monday(dt: datetime) -> datetime:
"""
If holiday falls on Saturday, use following Monday instead;
if holiday falls on Sunday, use Monday instead
if holiday falls on Sunday, use Monday instead.
"""
if dt.weekday() == 5:
return dt + timedelta(2)
Expand All @@ -55,7 +55,7 @@ def next_monday_or_tuesday(dt: datetime) -> datetime:
"""
For second holiday of two adjacent ones!
If holiday falls on Saturday, use following Monday instead;
if holiday falls on Sunday or Monday, use following Tuesday instead
if holiday falls on Sunday or Monday, use following Tuesday instead.
(because Monday is already taken by adjacent holiday on the day before)
"""
dow = dt.weekday()
Expand Down Expand Up @@ -113,7 +113,7 @@ def nearest_workday(dt: datetime) -> datetime:

def next_workday(dt: datetime) -> datetime:
"""
returns next workday used for observances
Returns next workday used for observances
"""
dt += timedelta(days=1)
while dt.weekday() > 4:
Expand All @@ -124,7 +124,7 @@ def next_workday(dt: datetime) -> datetime:

def previous_workday(dt: datetime) -> datetime:
"""
returns previous workday used for observances
Returns previous workday used for observances
"""
dt -= timedelta(days=1)
while dt.weekday() > 4:
Expand All @@ -135,15 +135,15 @@ def previous_workday(dt: datetime) -> datetime:

def before_nearest_workday(dt: datetime) -> datetime:
"""
returns previous workday before nearest workday
Returns previous workday before nearest workday
"""
return previous_workday(nearest_workday(dt))


def after_nearest_workday(dt: datetime) -> datetime:
"""
returns next workday after nearest workday
needed for Boxing day or multiple holidays in a series
Returns next workday after nearest workday
Needed for Boxing day or multiple holidays in a series
"""
return next_workday(nearest_workday(dt))

Expand Down
Loading