Skip to content

Commit 9fd7db5

Browse files
chalmerlowejreback
authored andcommitted
Resolution docstring (pandas-dev#21122)
1 parent 90cffc5 commit 9fd7db5

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

pandas/_libs/tslibs/timedeltas.pyx

+40-1
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,46 @@ cdef class _Timedelta(timedelta):
834834

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

839878
self._ensure_components()
840879
if self._ns:

0 commit comments

Comments
 (0)