Skip to content

Commit 1666a0a

Browse files
chalmerlowevictor
authored andcommitted
Resolution docstring (pandas-dev#21122)
1 parent a7673f6 commit 1666a0a

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,46 @@ cdef class _Timedelta(timedelta):
839839

840840
@property
841841
def resolution(self):
842-
""" return a string representing the lowest resolution that we have """
842+
"""
843+
Return a string representing the lowest timedelta resolution.
844+
845+
Each timedelta has a defined resolution that represents the lowest OR
846+
most granular level of precision. Each level of resolution is
847+
represented by a short string as defined below:
848+
849+
Resolution: Return value
850+
851+
* Days: 'D'
852+
* Hours: 'H'
853+
* Minutes: 'T'
854+
* Seconds: 'S'
855+
* Milliseconds: 'L'
856+
* Microseconds: 'U'
857+
* Nanoseconds: 'N'
858+
859+
Returns
860+
-------
861+
str
862+
Timedelta resolution.
863+
864+
Examples
865+
--------
866+
>>> td = pd.Timedelta('1 days 2 min 3 us 42 ns')
867+
>>> td.resolution
868+
'N'
869+
870+
>>> td = pd.Timedelta('1 days 2 min 3 us')
871+
>>> td.resolution
872+
'U'
873+
874+
>>> td = pd.Timedelta('2 min 3 s')
875+
>>> td.resolution
876+
'S'
877+
878+
>>> td = pd.Timedelta(36, unit='us')
879+
>>> td.resolution
880+
'U'
881+
"""
843882

844883
self._ensure_components()
845884
if self._ns:

0 commit comments

Comments
 (0)