Skip to content

Commit

Permalink
DOC: add SA01 ES01 for pandas.Timestamp.tz_convert and pandas.Timesta…
Browse files Browse the repository at this point in the history
…mp.astimezone (#58757)

DOC: add SA01 for pandas.Timestamp.tz_convert
  • Loading branch information
tuhinsharma121 committed May 17, 2024
1 parent 2753b17 commit 1a9a43d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.TimedeltaIndex.nanoseconds SA01" \
-i "pandas.TimedeltaIndex.seconds SA01" \
-i "pandas.TimedeltaIndex.to_pytimedelta RT03,SA01" \
-i "pandas.Timestamp.astimezone SA01" \
-i "pandas.Timestamp.ceil SA01" \
-i "pandas.Timestamp.combine PR01,SA01" \
-i "pandas.Timestamp.ctime SA01" \
Expand Down Expand Up @@ -284,7 +283,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Timestamp.today SA01" \
-i "pandas.Timestamp.toordinal SA01" \
-i "pandas.Timestamp.tz SA01" \
-i "pandas.Timestamp.tz_convert SA01" \
-i "pandas.Timestamp.tz_localize SA01" \
-i "pandas.Timestamp.tzinfo GL08" \
-i "pandas.Timestamp.tzname SA01" \
Expand Down
24 changes: 24 additions & 0 deletions pandas/_libs/tslibs/nattype.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,11 @@ class NaTType(_NaT):
"""
Convert timezone-aware Timestamp to another time zone.
This method is used to convert a timezone-aware Timestamp object to a
different time zone. The original UTC time remains the same; only the
time zone information is changed. If the Timestamp is timezone-naive, a
TypeError is raised.
Parameters
----------
tz : str, pytz.timezone, dateutil.tz.tzfile or None
Expand All @@ -837,6 +842,13 @@ class NaTType(_NaT):
TypeError
If Timestamp is tz-naive.
See Also
--------
Timestamp.tz_localize : Localize the Timestamp to a timezone.
DatetimeIndex.tz_convert : Convert a DatetimeIndex to another time zone.
DatetimeIndex.tz_localize : Localize a DatetimeIndex to a specific time zone.
datetime.datetime.astimezone : Convert a datetime object to another time zone.
Examples
--------
Create a timestamp object with UTC timezone:
Expand Down Expand Up @@ -1264,6 +1276,11 @@ timedelta}, default 'raise'
"""
Convert timezone-aware Timestamp to another time zone.
This method is used to convert a timezone-aware Timestamp object to a
different time zone. The original UTC time remains the same; only the
time zone information is changed. If the Timestamp is timezone-naive, a
TypeError is raised.
Parameters
----------
tz : str, pytz.timezone, dateutil.tz.tzfile or None
Expand All @@ -1279,6 +1296,13 @@ timedelta}, default 'raise'
TypeError
If Timestamp is tz-naive.
See Also
--------
Timestamp.tz_localize : Localize the Timestamp to a timezone.
DatetimeIndex.tz_convert : Convert a DatetimeIndex to another time zone.
DatetimeIndex.tz_localize : Localize a DatetimeIndex to a specific time zone.
datetime.datetime.astimezone : Convert a datetime object to another time zone.
Examples
--------
Create a timestamp object with UTC timezone:
Expand Down
12 changes: 12 additions & 0 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2470,6 +2470,11 @@ default 'raise'
"""
Convert timezone-aware Timestamp to another time zone.
This method is used to convert a timezone-aware Timestamp object to a
different time zone. The original UTC time remains the same; only the
time zone information is changed. If the Timestamp is timezone-naive, a
TypeError is raised.
Parameters
----------
tz : str, pytz.timezone, dateutil.tz.tzfile or None
Expand All @@ -2485,6 +2490,13 @@ default 'raise'
TypeError
If Timestamp is tz-naive.
See Also
--------
Timestamp.tz_localize : Localize the Timestamp to a timezone.
DatetimeIndex.tz_convert : Convert a DatetimeIndex to another time zone.
DatetimeIndex.tz_localize : Localize a DatetimeIndex to a specific time zone.
datetime.datetime.astimezone : Convert a datetime object to another time zone.
Examples
--------
Create a timestamp object with UTC timezone:
Expand Down

0 comments on commit 1a9a43d

Please sign in to comment.