Skip to content

Commit 5ba4337

Browse files
authored
DOC: Update doc description for day_opt in offsets (#24602)
Unlike shift_month, all other descriptions do not mention support of "None" as a value, since it is not supported in the other functions. Follow-up to gh-24585.
1 parent 10650b1 commit 5ba4337

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

pandas/_libs/tslibs/offsets.pyx

+20-5
Original file line numberDiff line numberDiff line change
@@ -903,9 +903,13 @@ cpdef int get_day_of_month(datetime other, day_opt) except? -1:
903903
Parameters
904904
----------
905905
other : datetime or Timestamp
906-
day_opt : 'start', 'end'
906+
day_opt : 'start', 'end', 'business_start', 'business_end', or int
907907
'start': returns 1
908908
'end': returns last day of the month
909+
'business_start': returns the first business day of the month
910+
'business_end': returns the last business day of the month
911+
int: returns the day in the month indicated by `other`, or the last of
912+
day the month if the value exceeds in that month's number of days.
909913
910914
Returns
911915
-------
@@ -980,14 +984,18 @@ def roll_qtrday(other: datetime, n: int, month: int,
980984
other : datetime or Timestamp
981985
n : number of periods to increment, before adjusting for rolling
982986
month : int reference month giving the first month of the year
983-
day_opt : 'start', 'end', 'business_start', 'business_end'
987+
day_opt : 'start', 'end', 'business_start', 'business_end', or int
984988
The convention to use in finding the day in a given month against
985989
which to compare for rollforward/rollbackward decisions.
986990
modby : int 3 for quarters, 12 for years
987991

988992
Returns
989993
-------
990994
n : int number of periods to increment
995+
996+
See Also
997+
--------
998+
get_day_of_month : Find the day in a month provided an offset.
991999
"""
9921000
cdef:
9931001
int months_since
@@ -1022,9 +1030,16 @@ def roll_yearday(other: datetime, n: int, month: int, day_opt: object) -> int:
10221030
other : datetime or Timestamp
10231031
n : number of periods to increment, before adjusting for rolling
10241032
month : reference month giving the first month of the year
1025-
day_opt : 'start', 'end'
1026-
'start': returns 1
1027-
'end': returns last day of the month
1033+
day_opt : 'start', 'end', 'business_start', 'business_end', or int
1034+
The day of the month to compare against that of `other` when
1035+
incrementing or decrementing the number of periods:
1036+
1037+
'start': 1
1038+
'end': last day of the month
1039+
'business_start': first business day of the month
1040+
'business_end': last business day of the month
1041+
int: day in the month indicated by `other`, or the last of day
1042+
the month if the value exceeds in that month's number of days.
10281043

10291044
Returns
10301045
-------

0 commit comments

Comments
 (0)