Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions pandas/_libs/tslibs/offsets.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cdef bint is_offset_object(object obj)
cdef bint is_tick_object(object obj)

cdef class BaseOffset:
cdef readonly:
int64_t n
bint normalize
dict _cache
cdef readonly:
int64_t n
bint normalize
dict _cache
17 changes: 3 additions & 14 deletions pandas/_libs/tslibs/offsets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1292,11 +1292,7 @@ cdef class BusinessDay(BusinessMixin):
self._offset = state.pop("_offset")
elif "offset" in state:
self._offset = state.pop("offset")

@property
def _params(self):
# FIXME: using cache_readonly breaks a pytables test
return BaseOffset._params.func(self)
self._cache = state.pop("_cache", {})

def _offset_str(self) -> str:
def get_str(td):
Expand Down Expand Up @@ -1383,8 +1379,6 @@ cdef class BusinessDay(BusinessMixin):
if self.n > 0:
shifted = (dtindex.to_perioddelta("B") - time).asi8 != 0

# Integer-array addition is deprecated, so we use
# _time_shift directly
roll = np.where(shifted, self.n - 1, self.n)
shifted = asper._addsub_int_array(roll, operator.add)
else:
Expand Down Expand Up @@ -2465,12 +2459,7 @@ cdef class Week(SingleConstructorOffset):
self.n = state.pop("n")
self.normalize = state.pop("normalize")
self.weekday = state.pop("weekday")

@property
def _params(self):
# TODO: making this into a property shouldn't be necessary, but otherwise
# we unpickle legacy objects incorrectly
return BaseOffset._params.func(self)
self._cache = state.pop("_cache", {})

def is_anchored(self) -> bool:
return self.n == 1 and self.weekday is not None
Expand Down Expand Up @@ -2520,7 +2509,7 @@ cdef class Week(SingleConstructorOffset):
from .frequencies import get_freq_code # TODO: avoid circular import

i8other = dtindex.asi8
off = (i8other % DAY_NANOS).view("timedelta64")
off = (i8other % DAY_NANOS).view("timedelta64[ns]")

base, mult = get_freq_code(self.freqstr)
base_period = dtindex.to_period(base)
Expand Down