How can I convert year, date, month to datetime?

Viewed 144

For example, I have a column with data such as:

17.14.11
17.15.10
18.21.06

which is 2017-11-14, and I'd like to change this to a DateTime object such as:

2017-11-14
2017-10-15
2018-06-21

I tried to use pd.to_datetime but I think it doesn't recognize the above as a date. How can I convert this using pandas' to_datetime function?

1 Answers

Check with format and to_datetime

pd.to_datetime(df['col'], format='%y.%d.%m')
Related