Skip to content

Commit b305aa4

Browse files
chalmerlowejorisvandenbossche
authored andcommitted
DOC: Improve the docstring of Timedelta.delta redux (pandas-dev#21138)
(cherry picked from commit 508ec3d)
1 parent 51f7cd6 commit b305aa4

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

pandas/_libs/tslibs/timedeltas.pyx

+26-1
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,32 @@ cdef class _Timedelta(timedelta):
760760

761761
@property
762762
def delta(self):
763-
""" return out delta in ns (for internal compat) """
763+
"""
764+
Return the timedelta in nanoseconds (ns), for internal compatibility.
765+
766+
Returns
767+
-------
768+
int
769+
Timedelta in nanoseconds.
770+
771+
Examples
772+
--------
773+
>>> td = pd.Timedelta('1 days 42 ns')
774+
>>> td.delta
775+
86400000000042
776+
777+
>>> td = pd.Timedelta('3 s')
778+
>>> td.delta
779+
3000000000
780+
781+
>>> td = pd.Timedelta('3 ms 5 us')
782+
>>> td.delta
783+
3005000
784+
785+
>>> td = pd.Timedelta(42, unit='ns')
786+
>>> td.delta
787+
42
788+
"""
764789
return self.value
765790

766791
@property

0 commit comments

Comments
 (0)