I'm trying to get the index of my dataFrame to be of type datetime. My CSV file contains seperate columns of Dates and Times which i combine upon importing:
df = pd.read_csv("example.csv", sep=";", decimal=",", parse_dates=[["Date", "Time"]])
It will look like this after the import:
Date_Time | |
---|---|
0 | 1012020 00:00:00 |
1 | 1012020 00:15:00 |
The problem is the missing leading zero on the first 9 days of each month. Pandas to_datetime()
needs a leading zero for the %d
format option to work. When i use format="%d%m%Y%H:%M:%S"
python says "invalid syntax"
How can I convert this column to datetime?