@@ -1038,6 +1038,25 @@ cdef class _Timedelta(timedelta):
10381038
10391039 @property
10401040 def value (self ):
1041+ """
1042+ Return the value of Timedelta object in nanoseconds.
1043+
1044+ Return the total seconds, milliseconds and microseconds
1045+ of the timedelta as nanoseconds.
1046+
1047+ Returns
1048+ -------
1049+ int
1050+
1051+ See Also
1052+ --------
1053+ Timedelta.unit : Return the unit of Timedelta object.
1054+
1055+ Examples
1056+ --------
1057+ >>> pd.Timedelta(1, "us").value
1058+ 1000
1059+ """
10411060 try :
10421061 return convert_reso(self ._value, self ._creso, NPY_FR_ns, False )
10431062 except OverflowError :
@@ -1120,6 +1139,37 @@ cdef class _Timedelta(timedelta):
11201139 def microseconds (self ) -> int: # TODO(cython3 ): make cdef property
11211140 # NB: using the python C-API PyDateTime_DELTA_GET_MICROSECONDS will fail
11221141 # (or be incorrect)
1142+ """
1143+ Return the number of microseconds (n), where 0 <= n < 1 millisecond.
1144+
1145+ Timedelta.microseconds = milliseconds * 1000 + microseconds.
1146+
1147+ Returns
1148+ -------
1149+ int
1150+ Number of microseconds.
1151+
1152+ See Also
1153+ --------
1154+ Timedelta.components : Return all attributes with assigned values
1155+ (i.e. days, hours, minutes, seconds, milliseconds, microseconds,
1156+ nanoseconds).
1157+
1158+ Examples
1159+ --------
1160+ **Using string input**
1161+
1162+ >>> td = pd.Timedelta('1 days 2 min 3 us')
1163+
1164+ >>> td.microseconds
1165+ 3
1166+
1167+ **Using integer input**
1168+
1169+ >>> td = pd.Timedelta(42, unit='us')
1170+ >>> td.microseconds
1171+ 42
1172+ """
11231173 self ._ensure_components()
11241174 return self ._ms * 1000 + self ._us
11251175
@@ -1141,6 +1191,26 @@ cdef class _Timedelta(timedelta):
11411191
11421192 @property
11431193 def unit(self ) -> str:
1194+ """
1195+ Return the unit of Timedelta object.
1196+
1197+ The unit of Timedelta object is nanosecond , i.e., 'ns' by default.
1198+
1199+ Returns
1200+ -------
1201+ str
1202+
1203+ See Also
1204+ --------
1205+ Timedelta.value : Return the value of Timedelta object in nanoseconds.
1206+ Timedelta.as_unit : Convert the underlying int64 representation to
1207+ the given unit.
1208+
1209+ Examples
1210+ --------
1211+ >>> td = pd.Timedelta(42 , unit = ' us' )
1212+ 'ns'
1213+ """
11441214 return npy_unit_to_abbrev(self._creso )
11451215
11461216 def __hash__(_Timedelta self ):
0 commit comments