Skip to content

Commit b3bc0c7

Browse files
committed
Update Docstrings for unit, utcoffset, utctimetuple
1 parent ea3e966 commit b3bc0c7

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,23 @@ cdef class _Timestamp(ABCTimestamp):
252252
@property
253253
def unit(self) -> str:
254254
"""
255-
The abbreviation associated with self._creso.
255+
The abbreviation associated with the Timestamp's resolution.
256+
257+
This property returns a string representing the time unit of the Timestamp's
258+
resolution. It corresponds to the smallest time unit that can be represented
259+
by this Timestamp object. The possible values are 's' (second), 'ms' (millisecond),
260+
'us' (microsecond), and 'ns' (nanosecond).
261+
262+
Returns
263+
-------
264+
str
265+
A string abbreviation of the Timestamp's resolution unit:
266+
's' for second, 'ms' for millisecond, 'us' for microsecond, or 'ns' for nanosecond.
267+
268+
See Also
269+
--------
270+
Timestamp.resolution : Return resolution of the Timestamp.
271+
pandas.Timedelta : A duration expressing the difference between two dates or times.
256272

257273
Examples
258274
--------
@@ -1754,7 +1770,14 @@ class Timestamp(_Timestamp):
17541770
17551771
Returns
17561772
--------
1757-
timedelta : The difference between UTC and the local time as a `timedelta` object.
1773+
timedelta
1774+
The difference between UTC and the local time as a `timedelta` object.
1775+
1776+
See Also
1777+
--------
1778+
datetime.datetime.utcoffset : Standard library method to get the UTC offset of a datetime object.
1779+
Timestamp.tzname : Return the name of the timezone.
1780+
Timestamp.dst : Return the daylight saving time (DST) adjustment.
17581781
17591782
Examples
17601783
--------
@@ -1770,6 +1793,22 @@ class Timestamp(_Timestamp):
17701793
"""
17711794
Return UTC time tuple, compatible with time.localtime().
17721795
1796+
This method converts the Timestamp to UTC and returns a time tuple
1797+
containing 9 components: year, month, day, hour, minute, second,
1798+
weekday, day of year, and DST flag. This is particularly useful for
1799+
converting a Timestamp to a format compatible with time module functions.
1800+
1801+
Returns
1802+
-------
1803+
time.struct_time
1804+
A time.struct_time object representing the UTC time.
1805+
1806+
See Also
1807+
--------
1808+
datetime.datetime.utctimetuple : Return UTC time tuple, compatible with time.localtime().
1809+
Timestamp.timetuple : Return time tuple of local time.
1810+
time.struct_time : Time tuple structure used by time functions.
1811+
17731812
Examples
17741813
--------
17751814
>>> ts = pd.Timestamp('2023-01-01 10:00:00', tz='Europe/Brussels')

0 commit comments

Comments
 (0)