@@ -1148,6 +1148,7 @@ cdef class Day(Tick):
1148
1148
_td64_unit = " D"
1149
1149
_period_dtype_code = PeriodDtypeCode.D
1150
1150
_reso = NPY_DATETIMEUNIT.NPY_FR_D
1151
+ _use_relativedelta = True
1151
1152
1152
1153
1153
1154
cdef class Hour(Tick):
@@ -1495,6 +1496,7 @@ cdef class BusinessMixin(SingleConstructorOffset):
1495
1496
"""
1496
1497
Mixin to business types to provide related functions.
1497
1498
"""
1499
+ _use_relativedelta = True
1498
1500
1499
1501
cdef readonly:
1500
1502
timedelta _offset
@@ -2068,6 +2070,7 @@ cdef class WeekOfMonthMixin(SingleConstructorOffset):
2068
2070
"""
2069
2071
Mixin for methods common to WeekOfMonth and LastWeekOfMonth.
2070
2072
"""
2073
+ _use_relativedelta = True
2071
2074
2072
2075
cdef readonly:
2073
2076
int weekday, week
@@ -2112,6 +2115,7 @@ cdef class YearOffset(SingleConstructorOffset):
2112
2115
DateOffset that just needs a month.
2113
2116
"""
2114
2117
_attributes = tuple ([" n" , " normalize" , " month" ])
2118
+ _use_relativedelta = True
2115
2119
2116
2120
# FIXME(cython#4446): python annotation here gives compile-time errors
2117
2121
# _default_month: int
@@ -2277,6 +2281,7 @@ cdef class QuarterOffset(SingleConstructorOffset):
2277
2281
# FIXME(cython#4446): python annotation here gives compile-time errors
2278
2282
# _default_starting_month: int
2279
2283
# _from_name_starting_month: int
2284
+ _use_relativedelta = True
2280
2285
2281
2286
cdef readonly:
2282
2287
int startingMonth
@@ -2448,6 +2453,8 @@ cdef class QuarterBegin(QuarterOffset):
2448
2453
# Month-Based Offset Classes
2449
2454
2450
2455
cdef class MonthOffset(SingleConstructorOffset):
2456
+ _use_relativedelta = True
2457
+
2451
2458
def is_on_offset (self , dt: datetime ) -> bool:
2452
2459
if self.normalize and not _is_normalized(dt ):
2453
2460
return False
@@ -2548,6 +2555,7 @@ cdef class SemiMonthOffset(SingleConstructorOffset):
2548
2555
_default_day_of_month = 15
2549
2556
_min_day_of_month = 2
2550
2557
_attributes = tuple ([" n" , " normalize" , " day_of_month" ])
2558
+ _use_relativedelta = True
2551
2559
2552
2560
cdef readonly:
2553
2561
int day_of_month
@@ -2750,6 +2758,7 @@ cdef class Week(SingleConstructorOffset):
2750
2758
_inc = timedelta(weeks = 1 )
2751
2759
_prefix = " W"
2752
2760
_attributes = tuple ([" n" , " normalize" , " weekday" ])
2761
+ _use_relativedelta = True
2753
2762
2754
2763
cdef readonly:
2755
2764
object weekday # int or None
@@ -3027,6 +3036,7 @@ cdef class LastWeekOfMonth(WeekOfMonthMixin):
3027
3036
# Special Offset Classes
3028
3037
3029
3038
cdef class FY5253Mixin(SingleConstructorOffset):
3039
+ _use_relativedelta = True
3030
3040
cdef readonly:
3031
3041
int startingMonth
3032
3042
int weekday
@@ -3496,6 +3506,7 @@ cdef class Easter(SingleConstructorOffset):
3496
3506
>>> ts + pd.offsets.Easter()
3497
3507
Timestamp('2022-04-17 00:00:00')
3498
3508
"""
3509
+ _use_relativedelta = True
3499
3510
3500
3511
cpdef __setstate__(self , state):
3501
3512
self .n = state.pop(" n" )
0 commit comments