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

Method _tz_convert

pandas/core/generic.py:10927–10937  ·  view source on GitHub ↗
(ax, tz)

Source from the content-addressed store, hash-verified

10925 ax = self._get_axis(axis)
10926
10927 def _tz_convert(ax, tz):
10928 if not hasattr(ax, "tz_convert"):
10929 if len(ax) > 0:
10930 ax_name = self._get_axis_name(axis)
10931 raise TypeError(
10932 f"{ax_name} is not a valid DatetimeIndex or PeriodIndex"
10933 )
10934 ax = DatetimeIndex([], tz=tz)
10935 else:
10936 ax = ax.tz_convert(tz)
10937 return ax
10938
10939 # if a level is given it must be a MultiIndex level or
10940 # equivalent to the axis name

Callers

nothing calls this directly

Calls 3

_get_axis_nameMethod · 0.95
tz_convertMethod · 0.95
DatetimeIndexClass · 0.50

Tested by

no test coverage detected