Wrong hour given by the expression "object.dt.hour"

49 views Asked by At

The code is returning the wrong hour at 09/04/2023 11:00:00. It is returning me the hour 10 for some reason.

I have a date column in a excel sheet with every hour in 2023 (01/01/2023 01:00:00 till today) and I used these lines in my python code:

colunas_planilha2['Hora'] = pd.to_datetime(colunas_planilha2['Dia/Hora'])
colunas_planilha2['Hora dt'] = pd.to_datetime(colunas_planilha2['Dia/Hora']).dt.hour

But I notice something wrong at 09/04/2023 11:00:00: https://i.stack.imgur.com/iwAk2.png

for some reason it's returning me the hour 10

Why did it happen? How can I fix it?

0

There are 0 answers