-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DEPR: Timedelta.freq, Timedelta.is_populated #46430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -826,13 +826,32 @@ cdef _to_py_int_float(v): | |
cdef class _Timedelta(timedelta): | ||
# cdef readonly: | ||
# int64_t value # nanoseconds | ||
# object freq # frequency reference | ||
# bint is_populated # are my components populated | ||
# bint _is_populated # are my components populated | ||
# int64_t _d, _h, _m, _s, _ms, _us, _ns | ||
|
||
# higher than np.ndarray and np.matrix | ||
__array_priority__ = 100 | ||
|
||
@property | ||
def freq(self) -> None: | ||
# GH#46430 | ||
warnings.warn( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does this do if its called? return None? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you make that explcit (and add the annotation) |
||
"Timedelta.freq is deprecated and will be removed in a future version", | ||
FutureWarning, | ||
stacklevel=1, | ||
) | ||
return None | ||
|
||
@property | ||
def is_populated(self) -> bool: | ||
# GH#46430 | ||
warnings.warn( | ||
"Timedelta.is_populated is deprecated and will be removed in a future version", | ||
FutureWarning, | ||
stacklevel=1, | ||
) | ||
return self._is_populated | ||
|
||
def __hash__(_Timedelta self): | ||
if self._has_ns(): | ||
return hash(self.value) | ||
|
@@ -881,7 +900,7 @@ cdef class _Timedelta(timedelta): | |
""" | ||
compute the components | ||
""" | ||
if self.is_populated: | ||
if self._is_populated: | ||
return | ||
|
||
cdef: | ||
|
@@ -898,7 +917,7 @@ cdef class _Timedelta(timedelta): | |
self._seconds = tds.seconds | ||
self._microseconds = tds.microseconds | ||
|
||
self.is_populated = 1 | ||
self._is_populated = 1 | ||
|
||
cpdef timedelta to_pytimedelta(_Timedelta self): | ||
""" | ||
|
@@ -1389,7 +1408,7 @@ class Timedelta(_Timedelta): | |
# make timedelta happy | ||
td_base = _Timedelta.__new__(cls, microseconds=int(value) // 1000) | ||
td_base.value = value | ||
td_base.is_populated = 0 | ||
td_base._is_populated = 0 | ||
return td_base | ||
|
||
def __setstate__(self, state): | ||
|
Uh oh!
There was an error while loading. Please reload this page.