'Python Pandas Conversion of days
I am trying to change string to a datetime64[ns] format in format days.month.year, but I get this error:
ValueError: time data '01.02.2016' does not match format '%dd.%mm.%YYYY' (match)
df['Start Date 2']= pd.to_datetime(df['Start Date'], format = "%dd.%mm.%YYYY")
Or Can I somehow modify this code? To have desired output in format of days.month.year?
df['Start Date 1']=df['Start Date'].astype('datetime64[ns]')
This is how the input values look like: '01.02.2016' it is in format days.months.years
I want the output look like this but being a datetime64[ns] format
Solution 1:[1]
This is the correct format:
df['Start Date 2']= pd.to_datetime(df['Start Date'], format = '%d.%m.%Y')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tomáš Ulrich |
