Skip to content

DOC: Fix docstrings for Timestamp: unit, utcoffset, utctimetuple #59480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ea3e966
Update docstring for utcoffset
shreyas-dev Aug 11, 2024
b3bc0c7
Update Docstrings for unit, utcoffset, utctimetuple
shreyas-dev Aug 11, 2024
950b7b5
Use old unit one-line description
shreyas-dev Aug 11, 2024
5b40a70
Remove pandas prefix from See Also due to SA05
shreyas-dev Aug 11, 2024
1332db7
Remove unit, utcoffset, utctimetuple from code checks
shreyas-dev Aug 11, 2024
ce06eb2
Add backticks
shreyas-dev Aug 11, 2024
fdbc64d
Add new line for extended summary in utcoffset
shreyas-dev Aug 11, 2024
13a7e14
DOC: Add missing single quote to `Timestamp.tz_localize` (#59472)
rob-sil Aug 11, 2024
130d28c
Update Docstrings for unit, utcoffset, utctimetuple
shreyas-dev Aug 11, 2024
6b90771
Remove unit, utcoffset, utctimetuple from code checks
shreyas-dev Aug 11, 2024
9a92fb4
Update nattype.pyx to match updated docstrings
shreyas-dev Aug 13, 2024
998708e
DOC: More doc fix for dtype_backend (#59071)
luke396 Aug 11, 2024
35d3172
DOC: Enforce Numpy Docstring Validation for pandas.Series.str methods…
awojno-bloomberg Aug 12, 2024
1975293
BUG (string dtype): convert dictionary input to materialized string a…
jorisvandenbossche Aug 12, 2024
8009ef3
Correct typo (#59486)
bmarika Aug 12, 2024
98bcfe2
use x.com and twitter's new X logo (#59482)
partev Aug 12, 2024
43d131d
String dtype: fix convert_dtypes() to convert NaN-string to NA-string…
jorisvandenbossche Aug 12, 2024
30e8df4
DOC: Clarify nrows behavior in read_csv (#59467)
johnyu013 Aug 12, 2024
9a3b105
STY: Add Yields section to option_context (#59490)
mroeschke Aug 12, 2024
a541768
BUG: Fix out-of-bounds access in safe_sort with an empty array and no…
jsspencer Aug 12, 2024
e7e6e6c
DOC: Fix docstrings for Timestamp: tz_localize, tzname, utcfromtimest…
MichaelMoyles Aug 12, 2024
ed1e78c
DEPS: Make pytz an optional dependency (#59089)
mroeschke Aug 12, 2024
c9148a5
String dtype: honor mode.string_storage option (and change default to…
jorisvandenbossche Aug 12, 2024
cbafad0
DOC: add pandas-gbq and related db-dtypes packages to ecosystem (#59491)
tswast Aug 12, 2024
3908e0a
Remove unit, utcoffset, utctimetuple from code checks
shreyas-dev Aug 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Timestamp.tz_localize SA01" \
-i "pandas.Timestamp.tzinfo GL08" \
-i "pandas.Timestamp.tzname SA01" \
-i "pandas.Timestamp.unit SA01" \
-i "pandas.Timestamp.utcfromtimestamp PR01,SA01" \
-i "pandas.Timestamp.utcoffset SA01" \
-i "pandas.Timestamp.utctimetuple SA01" \
-i "pandas.Timestamp.value GL08" \
-i "pandas.Timestamp.year GL08" \
-i "pandas.api.extensions.ExtensionArray._pad_or_backfill PR01,RT03,SA01" \
Expand Down
49 changes: 48 additions & 1 deletion pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,22 @@ cdef class _Timestamp(ABCTimestamp):
"""
The abbreviation associated with self._creso.

This property returns a string representing the time unit of the Timestamp's
resolution. It corresponds to the smallest time unit that can be represented
by this Timestamp object. The possible values are 's' (second), 'ms' (millisecond),
'us' (microsecond), and 'ns' (nanosecond).

Returns
-------
str
A string abbreviation of the Timestamp's resolution unit:
's' for second, 'ms' for millisecond, 'us' for microsecond, or 'ns' for nanosecond.

See Also
--------
Timestamp.resolution : Return resolution of the Timestamp.
Timedelta : A duration expressing the difference between two dates or times.

Examples
--------
>>> pd.Timestamp("2020-01-01 12:34:56").unit
Expand Down Expand Up @@ -1749,6 +1765,21 @@ class Timestamp(_Timestamp):
"""
Return utc offset.

This method returns the difference between UTC and the local time
as a `timedelta` object. It is useful for understanding the time
difference between the current timezone and UTC.

Returns
--------
timedelta
The difference between UTC and the local time as a `timedelta` object.

See Also
--------
datetime.datetime.utcoffset : Standard library method to get the UTC offset of a datetime object.
Timestamp.tzname : Return the name of the timezone.
Timestamp.dst : Return the daylight saving time (DST) adjustment.

Examples
--------
>>> ts = pd.Timestamp('2023-01-01 10:00:00', tz='Europe/Brussels')
Expand All @@ -1761,7 +1792,23 @@ class Timestamp(_Timestamp):

def utctimetuple(self):
"""
Return UTC time tuple, compatible with time.localtime().
Return UTC time tuple, compatible with `time.localtime()`.

This method converts the Timestamp to UTC and returns a time tuple
containing 9 components: year, month, day, hour, minute, second,
weekday, day of year, and DST flag. This is particularly useful for
converting a Timestamp to a format compatible with time module functions.

Returns
-------
time.struct_time
A time.struct_time object representing the UTC time.

See Also
--------
datetime.datetime.utctimetuple : Return UTC time tuple, compatible with time.localtime().
Timestamp.timetuple : Return time tuple of local time.
time.struct_time : Time tuple structure used by time functions.

Examples
--------
Expand Down
Loading