Even though the single-level index of my dataframe shown below is clearly a pd.DatetimeIndex, it is still also identified as a pd.Int64Index.
In what follows, I demonstrate this behavior via printouts in the VS Code debugging console:
df.index
DatetimeIndex(['2018-01-01 00:00:00+01:00', '2018-01-01 01:00:00+01:00',
'2018-01-01 02:00:00+01:00', '2018-01-01 03:00:00+01:00',
'2018-01-01 04:00:00+01:00', '2018-01-01 05:00:00+01:00',
'2018-01-01 06:00:00+01:00', '2018-01-01 07:00:00+01:00',
'2018-01-01 08:00:00+01:00', '2018-01-01 09:00:00+01:00',
...
'2019-08-24 14:00:00+02:00', '2019-08-25 14:00:00+02:00',
'2019-08-26 14:00:00+02:00', '2019-08-26 15:00:00+02:00',
'2019-08-27 15:00:00+02:00', '2019-08-28 15:00:00+02:00',
'2019-08-29 14:00:00+02:00', '2019-08-30 14:00:00+02:00',
'2019-08-31 14:00:00+02:00', '2019-08-31 15:00:00+02:00'],
dtype='datetime64[ns, Europe/Madrid]', name='Time', length=13493, freq=None)
isinstance(df.index, pd.DatetimeIndex)
True
isinstance(df.index, pd.Int64Index)
True
Note on import program and module versions employed:
I'm using Python 3.7.7 (default, Apr 20 2020, 05:55:00) [GCC 5.4.0 20160609] on linux Lubuntu 18.04 LTS.
As for the pandas version: 1.0.5
From the source code:
> class DatetimeIndex(DatetimeTimedeltaMixin, DatetimeDelegateMixin):
> """
> Immutable ndarray of datetime64 data, represented internally as int64, and
> which can be boxed to Timestamp objects that are subclasses of datetime and
> carry metadata such as frequency information.
> [...]