@@ -3712,7 +3712,7 @@ cdef shift_quarters(
37123712 const int64_t[:] dtindex ,
37133713 int quarters ,
37143714 int q1start_month ,
3715- object day ,
3715+ object day_opt ,
37163716 int modby = 3 ,
37173717):
37183718 """
@@ -3724,7 +3724,7 @@ cdef shift_quarters(
37243724 dtindex : int64_t[:] timestamps for input dates
37253725 quarters : int number of quarters to shift
37263726 q1start_month : int month in which Q1 begins by convention
3727- day : {'start', 'end', 'business_start', 'business_end'}
3727+ day_opt : {'start', 'end', 'business_start', 'business_end'}
37283728 modby : int (3 for quarters, 12 for years)
37293729
37303730 Returns
@@ -3737,9 +3737,9 @@ cdef shift_quarters(
37373737 int count = len (dtindex)
37383738 int months_to_roll, months_since, n, compare_day
37393739 bint roll_check
3740- int64_t[:] out = np.empty(count, dtype = ' int64' )
3740+ int64_t[:] out = np.empty(count, dtype = " int64" )
37413741
3742- if day == ' start' :
3742+ if day_opt == " start" :
37433743 with nogil:
37443744 for i in range (count):
37453745 if dtindex[i] == NPY_NAT:
@@ -3763,7 +3763,7 @@ cdef shift_quarters(
37633763
37643764 out[i] = dtstruct_to_dt64(& dts)
37653765
3766- elif day == ' end' :
3766+ elif day_opt == " end" :
37673767 with nogil:
37683768 for i in range (count):
37693769 if dtindex[i] == NPY_NAT:
@@ -3792,7 +3792,7 @@ cdef shift_quarters(
37923792
37933793 out[i] = dtstruct_to_dt64(& dts)
37943794
3795- elif day == ' business_start' :
3795+ elif day_opt == " business_start" :
37963796 with nogil:
37973797 for i in range (count):
37983798 if dtindex[i] == NPY_NAT:
@@ -3823,7 +3823,7 @@ cdef shift_quarters(
38233823
38243824 out[i] = dtstruct_to_dt64(& dts)
38253825
3826- elif day == ' business_end' :
3826+ elif day_opt == " business_end" :
38273827 with nogil:
38283828 for i in range (count):
38293829 if dtindex[i] == NPY_NAT:
@@ -3863,12 +3863,12 @@ cdef shift_quarters(
38633863
38643864@ cython.wraparound (False )
38653865@ cython.boundscheck (False )
3866- def shift_months (const int64_t[:] dtindex , int months , object day = None ):
3866+ def shift_months (const int64_t[:] dtindex , int months , object day_opt = None ):
38673867 """
38683868 Given an int64-based datetime index, shift all elements
38693869 specified number of months using DateOffset semantics
38703870
3871- day : {None, 'start', 'end'}
3871+ day_opt : {None, 'start', 'end', 'business_start', 'business_end '}
38723872 * None: day of month
38733873 * 'start' 1st day of month
38743874 * 'end' last day of month
@@ -3879,9 +3879,9 @@ def shift_months(const int64_t[:] dtindex, int months, object day=None):
38793879 int count = len (dtindex)
38803880 int months_to_roll
38813881 bint roll_check
3882- int64_t[:] out = np.empty(count, dtype = ' int64' )
3882+ int64_t[:] out = np.empty(count, dtype = " int64" )
38833883
3884- if day is None :
3884+ if day_opt is None :
38853885 with nogil:
38863886 for i in range (count):
38873887 if dtindex[i] == NPY_NAT:
@@ -3894,7 +3894,7 @@ def shift_months(const int64_t[:] dtindex, int months, object day=None):
38943894
38953895 dts.day = min (dts.day, get_days_in_month(dts.year, dts.month))
38963896 out[i] = dtstruct_to_dt64(& dts)
3897- elif day == ' start' :
3897+ elif day_opt == " start" :
38983898 roll_check = False
38993899 if months <= 0 :
39003900 months += 1
@@ -3918,7 +3918,7 @@ def shift_months(const int64_t[:] dtindex, int months, object day=None):
39183918 dts.day = 1
39193919
39203920 out[i] = dtstruct_to_dt64(& dts)
3921- elif day == ' end' :
3921+ elif day_opt == " end" :
39223922 roll_check = False
39233923 if months > 0 :
39243924 months -= 1
@@ -3944,7 +3944,7 @@ def shift_months(const int64_t[:] dtindex, int months, object day=None):
39443944 dts.day = get_days_in_month(dts.year, dts.month)
39453945 out[i] = dtstruct_to_dt64(& dts)
39463946
3947- elif day == ' business_start' :
3947+ elif day_opt == " business_start" :
39483948 with nogil:
39493949 for i in range (count):
39503950 if dtindex[i] == NPY_NAT:
@@ -3964,7 +3964,7 @@ def shift_months(const int64_t[:] dtindex, int months, object day=None):
39643964 dts.day = get_firstbday(dts.year, dts.month)
39653965 out[i] = dtstruct_to_dt64(& dts)
39663966
3967- elif day == ' business_end' :
3967+ elif day_opt == " business_end" :
39683968 with nogil:
39693969 for i in range (count):
39703970 if dtindex[i] == NPY_NAT:
@@ -4060,13 +4060,11 @@ cdef int get_day_of_month(datetime other, day_opt) except? -1:
40604060 Parameters
40614061 ----------
40624062 other : datetime or Timestamp
4063- day_opt : 'start', 'end', 'business_start', 'business_end', or int
4063+ day_opt : { 'start', 'end', 'business_start', 'business_end'}
40644064 'start': returns 1
40654065 'end': returns last day of the month
40664066 'business_start': returns the first business day of the month
40674067 'business_end': returns the last business day of the month
4068- int: returns the day in the month indicated by `other`, or the last of
4069- day the month if the value exceeds in that month's number of days.
40704068
40714069 Returns
40724070 -------
@@ -4095,9 +4093,6 @@ cdef int get_day_of_month(datetime other, day_opt) except? -1:
40954093 elif day_opt == ' business_end' :
40964094 # last business day of month
40974095 return get_lastbday(other.year, other.month)
4098- elif is_integer_object(day_opt):
4099- days_in_month = get_days_in_month(other.year, other.month)
4100- return min (day_opt, days_in_month)
41014096 elif day_opt is None :
41024097 # Note: unlike `shift_month`, get_day_of_month does not
41034098 # allow day_opt = None
0 commit comments