Skip to content

Commit 720d532

Browse files
committed
DOC: mention tz_convert(None) and tz_localize(None) for dataframe or series
1 parent 2e55bff commit 720d532

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pandas/core/generic.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -10133,9 +10133,13 @@ def tz_convert(
1013310133
"""
1013410134
Convert tz-aware axis to target time zone.
1013510135
10136+
To convert to UTC and get a tz-naive axis, pass tz=None.
10137+
1013610138
Parameters
1013710139
----------
10138-
tz : str or tzinfo object
10140+
tz : str or tzinfo object or None
10141+
Time zone to convert index to. Passing ``None`` will convert to
10142+
UTC and remove the timezone information.
1013910143
axis : the axis to convert
1014010144
level : int, str, default None
1014110145
If axis is a MultiIndex, convert a specific level. Otherwise
@@ -10200,9 +10204,14 @@ def tz_localize(
1020010204
This operation localizes the Index. To localize the values in a
1020110205
timezone-naive Series, use :meth:`Series.dt.tz_localize`.
1020210206
10207+
This method can also used to do the inverse -- to get a tz-naive index
10208+
from a time zone aware index, pass tz=None.
10209+
1020310210
Parameters
1020410211
----------
10205-
tz : str or tzinfo
10212+
tz : str or tzinfo or None
10213+
Time zone to convert the index to. pass ``None`` will remove the
10214+
time zone information and preserve local time.
1020610215
axis : the axis to localize
1020710216
level : int, str, default None
1020810217
If axis ia a MultiIndex, localize a specific level. Otherwise

0 commit comments

Comments
 (0)