pandas.DatetimeIndex.hour#

property DatetimeIndex.hour[source]#

The hours of the datetime.

This attribute returns the hour component of each datetime value in the DatetimeIndex.

See also

DatetimeIndex.day

The day of the datetime.

DatetimeIndex.minute

The minutes of the datetime.

DatetimeIndex.second

The seconds of the datetime.

Examples

>>> idx = pd.date_range("2000-01-01", periods=3, freq="h")
>>> idx.hour
Index([0, 1, 2], dtype='int32')