0

I am working with a column named "Time". This has hours in military time format, each row represents an hour. The goal is to convert each row into a datetime hours, however I keep running into this Value Error. I have tried using strip to no success. Below I have listed all the values in the column, the code to convert into datetime and the error. Let me know if I should show my strip code, I am very new so maybe I screwed that up.

array(['21', '10', '15', '13', '12', '08', '20', '02', '19', '11', '00',
       '03', '18', '17', '06', '05', '23', '01', '22', '14', '09', '16',
       '04', '07', '24'], dtype=object)

df['Time'] = pd.to_datetime(df['Time'], format= '%H')

ValueError: unconverted data remains: 4
sus_zeus
  • 83
  • 9

0 Answers0