Skip to content

Commit

Permalink
Backport PR #52354 on branch 2.0.x (Fixed up formatting of docstring …
Browse files Browse the repository at this point in the history
…of DateOffset) (#52361)

Backport PR #52354: Fixed up formatting of docstring of DateOffset

Co-authored-by: Nishu Choudhary <51842539+choudharynishu@users.noreply.github.com>
  • Loading branch information
meeseeksmachine and choudharynishu committed Apr 2, 2023
1 parent c922324 commit 39e0505
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pandas/_libs/tslibs/offsets.pyx
Expand Up @@ -1347,18 +1347,18 @@ class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta):
valid dates. For example, Bday(2) can be added to a date to move
it two business days forward. If the date does not start on a
valid date, first it is moved to a valid date. Thus pseudo code
is:
is::
def __add__(date):
date = rollback(date) # does nothing if date is valid
return date + <n number of periods>
def __add__(date):
date = rollback(date) # does nothing if date is valid
return date + <n number of periods>
When a date offset is created for a negative number of periods,
the date is first rolled forward. The pseudo code is:
the date is first rolled forward. The pseudo code is::
def __add__(date):
date = rollforward(date) # does nothing is date is valid
return date + <n number of periods>
def __add__(date):
date = rollforward(date) # does nothing if date is valid
return date + <n number of periods>
Zero presents a problem. Should it roll forward or back? We
arbitrarily have it rollforward:
Expand Down

0 comments on commit 39e0505

Please sign in to comment.