pandas.DatetimeIndex.tz#
- property DatetimeIndex.tz[source]#
Return the timezone.
- Returns:
- datetime.tzinfo, pytz.tzinfo.BaseTZInfo, dateutil.tz.tz.tzfile, or None
Returns None when the array is tz-naive.
Examples
For Series:
>>> s = pd.Series(["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"]) >>> s = pd.to_datetime(s) >>> s 0 2020-01-01 10:00:00+00:00 1 2020-02-01 11:00:00+00:00 dtype: datetime64[ns, UTC] >>> s.dt.tz datetime.timezone.utc
For DatetimeIndex:
>>> idx = pd.DatetimeIndex(["1/1/2020 10:00:00+00:00", ... "2/1/2020 11:00:00+00:00"]) >>> idx.tz datetime.timezone.utc