MCPcopy
hub / github.com/pandas-dev/pandas / _tz_localize

Method _tz_localize

pandas/core/generic.py:11138–11148  ·  view source on GitHub ↗
(ax, tz, ambiguous, nonexistent)

Source from the content-addressed store, hash-verified

11136 ax = self._get_axis(axis)
11137
11138 def _tz_localize(ax, tz, ambiguous, nonexistent):
11139 if not hasattr(ax, "tz_localize"):
11140 if len(ax) > 0:
11141 ax_name = self._get_axis_name(axis)
11142 raise TypeError(
11143 f"{ax_name} is not a valid DatetimeIndex or PeriodIndex"
11144 )
11145 ax = DatetimeIndex([], tz=tz)
11146 else:
11147 ax = ax.tz_localize(tz, ambiguous=ambiguous, nonexistent=nonexistent)
11148 return ax
11149
11150 # if a level is given it must be a MultiIndex level or
11151 # equivalent to the axis name

Callers

nothing calls this directly

Calls 3

_get_axis_nameMethod · 0.95
tz_localizeMethod · 0.95
DatetimeIndexClass · 0.50

Tested by

no test coverage detected