@@ -240,11 +240,11 @@ cpdef int64_t delta_to_nanoseconds(
240240
241241 if is_tick_object(delta):
242242 n = delta.n
243- in_reso = delta._reso
243+ in_reso = delta._creso
244244
245245 elif isinstance (delta, _Timedelta):
246246 n = delta.value
247- in_reso = delta._reso
247+ in_reso = delta._creso
248248
249249 elif is_timedelta64_object(delta):
250250 in_reso = get_datetime64_unit(delta)
@@ -339,7 +339,7 @@ cdef convert_to_timedelta64(object ts, str unit):
339339 return np.timedelta64(NPY_NAT, " ns" )
340340 elif isinstance (ts, _Timedelta):
341341 # already in the proper format
342- if ts._reso != NPY_FR_ns:
342+ if ts._creso != NPY_FR_ns:
343343 ts = ts._as_unit(" ns" ).asm8
344344 else :
345345 ts = np.timedelta64(ts.value, " ns" )
@@ -740,7 +740,7 @@ cdef bint _validate_ops_compat(other):
740740def _op_unary_method (func , name ):
741741 def f (self ):
742742 new_value = func(self .value)
743- return _timedelta_from_value_and_reso(new_value, self ._reso )
743+ return _timedelta_from_value_and_reso(new_value, self ._creso )
744744 f.__name__ = name
745745 return f
746746
@@ -792,18 +792,18 @@ def _binary_op_method_timedeltalike(op, name):
792792
793793 # Matching numpy, we cast to the higher resolution. Unlike numpy,
794794 # we raise instead of silently overflowing during this casting.
795- if self ._reso < other._reso :
796- self = (< _Timedelta> self )._as_creso(other._reso , round_ok = True )
797- elif self ._reso > other._reso :
798- other = (< _Timedelta> other)._as_creso(self ._reso , round_ok = True )
795+ if self ._creso < other._creso :
796+ self = (< _Timedelta> self )._as_creso(other._creso , round_ok = True )
797+ elif self ._creso > other._creso :
798+ other = (< _Timedelta> other)._as_creso(self ._creso , round_ok = True )
799799
800800 res = op(self .value, other.value)
801801 if res == NPY_NAT:
802802 # e.g. test_implementation_limits
803803 # TODO: more generally could do an overflowcheck in op?
804804 return NaT
805805
806- return _timedelta_from_value_and_reso(res, reso = self ._reso )
806+ return _timedelta_from_value_and_reso(res, reso = self ._creso )
807807
808808 f.__name__ = name
809809 return f
@@ -970,7 +970,7 @@ cdef _timedelta_from_value_and_reso(int64_t value, NPY_DATETIMEUNIT reso):
970970
971971 td_base.value = value
972972 td_base._is_populated = 0
973- td_base._reso = reso
973+ td_base._creso = reso
974974 return td_base
975975
976976
@@ -996,7 +996,7 @@ class MinMaxReso:
996996 # i.e. this is on the class, default to nanos
997997 return Timedelta(val)
998998 else :
999- return Timedelta._from_value_and_reso(val, obj._reso )
999+ return Timedelta._from_value_and_reso(val, obj._creso )
10001000
10011001 def __set__ (self , obj , value ):
10021002 raise AttributeError (f" {self._name} is not settable." )
@@ -1022,9 +1022,9 @@ cdef class _Timedelta(timedelta):
10221022 @property
10231023 def _unit (self ) -> str:
10241024 """
1025- The abbreviation associated with self._reso .
1025+ The abbreviation associated with self._creso .
10261026 """
1027- return npy_unit_to_abbrev(self._reso )
1027+ return npy_unit_to_abbrev(self._creso )
10281028
10291029 @property
10301030 def days(self ) -> int: # TODO(cython3 ): make cdef property
@@ -1127,7 +1127,7 @@ cdef class _Timedelta(timedelta):
11271127 else :
11281128 return NotImplemented
11291129
1130- if self ._reso == ots._reso :
1130+ if self ._creso == ots._creso :
11311131 return cmp_scalar(self .value, ots.value, op)
11321132 return self ._compare_mismatched_resos(ots, op)
11331133
@@ -1139,18 +1139,18 @@ cdef class _Timedelta(timedelta):
11391139 npy_datetimestruct dts_other
11401140
11411141 # dispatch to the datetimestruct utils instead of writing new ones!
1142- pandas_datetime_to_datetimestruct(self .value, self ._reso , & dts_self)
1143- pandas_datetime_to_datetimestruct(other.value, other._reso , & dts_other)
1142+ pandas_datetime_to_datetimestruct(self .value, self ._creso , & dts_self)
1143+ pandas_datetime_to_datetimestruct(other.value, other._creso , & dts_other)
11441144 return cmp_dtstructs(& dts_self, & dts_other, op)
11451145
11461146 cdef bint _has_ns(self ):
1147- if self ._reso == NPY_FR_ns:
1147+ if self ._creso == NPY_FR_ns:
11481148 return self .value % 1000 != 0
1149- elif self ._reso < NPY_FR_ns:
1149+ elif self ._creso < NPY_FR_ns:
11501150 # i.e. seconds, millisecond, microsecond
11511151 return False
11521152 else :
1153- raise NotImplementedError (self ._reso )
1153+ raise NotImplementedError (self ._creso )
11541154
11551155 cdef _ensure_components(_Timedelta self ):
11561156 """
@@ -1162,7 +1162,7 @@ cdef class _Timedelta(timedelta):
11621162 cdef:
11631163 pandas_timedeltastruct tds
11641164
1165- pandas_timedelta_to_timedeltastruct(self .value, self ._reso , & tds)
1165+ pandas_timedelta_to_timedeltastruct(self .value, self ._creso , & tds)
11661166 self ._d = tds.days
11671167 self ._h = tds.hrs
11681168 self ._m = tds.min
@@ -1194,7 +1194,7 @@ cdef class _Timedelta(timedelta):
11941194 -----
11951195 Any nanosecond resolution will be lost.
11961196 """
1197- if self ._reso == NPY_FR_ns:
1197+ if self ._creso == NPY_FR_ns:
11981198 return timedelta(microseconds = int (self .value) / 1000 )
11991199
12001200 # TODO(@WillAyd): is this the right way to use components?
@@ -1208,7 +1208,7 @@ cdef class _Timedelta(timedelta):
12081208 Return a numpy.timedelta64 object with 'ns' precision.
12091209 """
12101210 cdef:
1211- str abbrev = npy_unit_to_abbrev(self ._reso )
1211+ str abbrev = npy_unit_to_abbrev(self ._creso )
12121212 # TODO: way to create a np.timedelta64 obj with the reso directly
12131213 # instead of having to get the abbrev?
12141214 return np.timedelta64(self.value , abbrev )
@@ -1548,11 +1548,11 @@ cdef class _Timedelta(timedelta):
15481548 cdef:
15491549 int64_t value
15501550
1551- if reso == self ._reso :
1551+ if reso == self ._creso :
15521552 return self
15531553
15541554 try :
1555- value = convert_reso(self .value, self ._reso , reso, round_ok = round_ok)
1555+ value = convert_reso(self .value, self ._creso , reso, round_ok = round_ok)
15561556 except OverflowError as err:
15571557 unit = npy_unit_to_abbrev(reso)
15581558 raise OutOfBoundsTimedelta(
@@ -1565,10 +1565,10 @@ cdef class _Timedelta(timedelta):
15651565 """
15661566 If _resos do not match, cast to the higher resolution, raising on overflow.
15671567 """
1568- if self ._reso > other._reso :
1569- other = other._as_creso(self ._reso )
1570- elif self ._reso < other._reso :
1571- self = self ._as_creso(other._reso )
1568+ if self ._creso > other._creso :
1569+ other = other._as_creso(self ._creso )
1570+ elif self ._creso < other._creso :
1571+ self = self ._as_creso(other._creso )
15721572 return self , other
15731573
15741574
@@ -1736,7 +1736,7 @@ class Timedelta(_Timedelta):
17361736 return cls ._from_value_and_reso(new_value, reso = new_reso)
17371737
17381738 elif is_tick_object(value):
1739- new_reso = get_supported_reso(value._reso )
1739+ new_reso = get_supported_reso(value._creso )
17401740 new_value = delta_to_nanoseconds(value, reso = new_reso)
17411741 return cls ._from_value_and_reso(new_value, reso = new_reso)
17421742
@@ -1769,10 +1769,10 @@ class Timedelta(_Timedelta):
17691769 else :
17701770 value, reso = state
17711771 self .value = value
1772- self ._reso = reso
1772+ self ._creso = reso
17731773
17741774 def __reduce__ (self ):
1775- object_state = self .value, self ._reso
1775+ object_state = self .value, self ._creso
17761776 return (_timedelta_unpickle, object_state)
17771777
17781778 @ cython.cdivision (True )
@@ -1784,11 +1784,11 @@ class Timedelta(_Timedelta):
17841784 from pandas._libs.tslibs.offsets import to_offset
17851785
17861786 to_offset(freq).nanos # raises on non-fixed freq
1787- unit = delta_to_nanoseconds(to_offset(freq), self ._reso )
1787+ unit = delta_to_nanoseconds(to_offset(freq), self ._creso )
17881788
17891789 arr = np.array([self .value], dtype = " i8" )
17901790 result = round_nsint64(arr, mode, unit)[0 ]
1791- return Timedelta._from_value_and_reso(result, self ._reso )
1791+ return Timedelta._from_value_and_reso(result, self ._creso )
17921792
17931793 def round (self , freq ):
17941794 """
@@ -1852,7 +1852,7 @@ class Timedelta(_Timedelta):
18521852
18531853 return _timedelta_from_value_and_reso(
18541854 < int64_t> (other * self .value),
1855- reso = self ._reso ,
1855+ reso = self ._creso ,
18561856 )
18571857
18581858 elif is_array(other):
@@ -1875,7 +1875,7 @@ class Timedelta(_Timedelta):
18751875 other = Timedelta(other)
18761876 if other is NaT:
18771877 return np.nan
1878- if other._reso != self ._reso :
1878+ if other._creso != self ._creso :
18791879 self , other = self ._maybe_cast_to_matching_resos(other)
18801880 return self .value / float (other.value)
18811881
@@ -1884,7 +1884,7 @@ class Timedelta(_Timedelta):
18841884 if util.is_nan(other):
18851885 return NaT
18861886 return Timedelta._from_value_and_reso(
1887- < int64_t> (self .value / other), self ._reso
1887+ < int64_t> (self .value / other), self ._creso
18881888 )
18891889
18901890 elif is_array(other):
@@ -1902,7 +1902,7 @@ class Timedelta(_Timedelta):
19021902 other = Timedelta(other)
19031903 if other is NaT:
19041904 return np.nan
1905- if self ._reso != other._reso :
1905+ if self ._creso != other._creso :
19061906 self , other = self ._maybe_cast_to_matching_resos(other)
19071907 return float (other.value) / self .value
19081908
@@ -1930,14 +1930,14 @@ class Timedelta(_Timedelta):
19301930 other = Timedelta(other)
19311931 if other is NaT:
19321932 return np.nan
1933- if self ._reso != other._reso :
1933+ if self ._creso != other._creso :
19341934 self , other = self ._maybe_cast_to_matching_resos(other)
19351935 return self .value // other.value
19361936
19371937 elif is_integer_object(other) or is_float_object(other):
19381938 if util.is_nan(other):
19391939 return NaT
1940- return type (self )._from_value_and_reso(self .value // other, self ._reso )
1940+ return type (self )._from_value_and_reso(self .value // other, self ._creso )
19411941
19421942 elif is_array(other):
19431943 if other.ndim == 0 :
@@ -1975,7 +1975,7 @@ class Timedelta(_Timedelta):
19751975 other = Timedelta(other)
19761976 if other is NaT:
19771977 return np.nan
1978- if self ._reso != other._reso :
1978+ if self ._creso != other._creso :
19791979 self , other = self ._maybe_cast_to_matching_resos(other)
19801980 return other.value // self .value
19811981
0 commit comments