Skip to content

Commit 248fae2

Browse files
chalmerlowejorisvandenbossche
authored andcommitted
DOC: updated docstring for nanoseconds function per doc guidelines (#21065)
(cherry picked from commit 9f40757)
1 parent 4b30521 commit 248fae2

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

pandas/_libs/tslibs/timedeltas.pyx

+25-2
Original file line numberDiff line numberDiff line change
@@ -791,9 +791,32 @@ cdef class _Timedelta(timedelta):
791791
@property
792792
def nanoseconds(self):
793793
"""
794-
Number of nanoseconds (>= 0 and less than 1 microsecond).
794+
Return the number of nanoseconds (n), where 0 <= n < 1 microsecond.
795+
796+
Returns
797+
-------
798+
int
799+
Number of nanoseconds.
800+
801+
See Also
802+
--------
803+
Timedelta.components : Return all attributes with assigned values
804+
(i.e. days, hours, minutes, seconds, milliseconds, microseconds,
805+
nanoseconds).
806+
807+
Examples
808+
--------
809+
**Using string input**
810+
811+
>>> td = pd.Timedelta('1 days 2 min 3 us 42 ns')
812+
>>> td.nanoseconds
813+
42
814+
815+
**Using integer input**
795816
796-
.components will return the shown components
817+
>>> td = pd.Timedelta(42, unit='ns')
818+
>>> td.nanoseconds
819+
42
797820
"""
798821
self._ensure_components()
799822
return self._ns

0 commit comments

Comments
 (0)