Given your details:
df_energy2.head()
TIMESTAMP P_ACT_KW PERIODE_TARIF P_SOUSCR
2016-01-01 00:00:00 116 HC 250
2016-01-01 00:10:00 121 HC 250
You have a timestamp as an index. To retrieve a clock from a timestamp, where you have an index in a data frame:
hours = df_energy2.index.hour
Edit : Yes, Jezerael, you're right. Assuming what he said: pandas dataframe has a property for this, i.e. dt:
<dataframe>.<ts_column>.dt.hour
An example in your context is a date column TIMESTAMP
df.TIMESTAMP.dt.hour
- Pandas, dataframe datetime64,