Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Timestamp.max PR02" \
-i "pandas.Timestamp.min PR02" \
-i "pandas.Timestamp.resolution PR02" \
-i "pandas.Timestamp.tzinfo GL08" \
-i "pandas.core.groupby.DataFrameGroupBy.plot PR02" \
-i "pandas.core.groupby.SeriesGroupBy.plot PR02" \
-i "pandas.core.resample.Resampler.quantile PR01,PR07" \
Expand Down
28 changes: 28 additions & 0 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2208,6 +2208,34 @@ class Timestamp(_Timestamp):
"""
return super().tzname()

@property
def tzinfo(self):
"""
Returns the timezone info of the Timestamp.

This property returns a `datetime.tzinfo` object if the Timestamp
is timezone-aware. If the Timestamp has no timezone, it returns `None`.
If the Timestamp is in UTC or a fixed-offset timezone,
it returns `datetime.timezone`. If the Timestamp uses an
IANA timezone (e.g., "America/New_York"), it returns `zoneinfo.ZoneInfo`.

See Also
--------
Timestamp.tz : Alias for `tzinfo`, may return a `zoneinfo.ZoneInfo` object.
Timestamp.tz_convert : Convert timezone-aware Timestamp to another time zone.
Timestamp.tz_localize : Localize the Timestamp to a specific timezone.

Examples
--------
>>> ts = pd.Timestamp("2023-01-01 12:00:00", tz="UTC")
>>> ts.tzinfo
datetime.timezone.utc

>>> ts_naive = pd.Timestamp("2023-01-01 12:00:00")
>>> ts_naive.tzinfo
"""
return super().tzinfo

def utcoffset(self):
"""
Return utc offset.
Expand Down
Loading