I want to convert dates of which are less than 1970 to pd.to_datetime format but am unable to do so as any date less than 1970 gets converted to the new millennium (>2000).
I want the dates to be converted as follows:
15/01/1967 to 1967-01-15
14/01/1968 to 1968-01-14
12/01/1969 to 1969-01-12
It rather gets converted as follows when I used pd.to_datetime().
15/01/1967 to 2067-01-15
14/01/1968 to 2068-01-14
12/01/1969 to 2069-01-12
I set the origin value in pd.to_datetime to be 1900 (as in the pandas documentation), but it doesn't recognise the term "origin".
works fine for me if I provide a specific format for pd.to_datetime
:
import pandas as pd
s = pd.Series(["15/01/1967", "14/01/1968", "12/01/1969"])
pd.to_datetime(s, format='%d/%m/%Y')
# 0 1967-01-15
# 1 1968-01-14
# 2 1969-01-12
# dtype: datetime64[ns]
pandas 1.0.5
on Python 3.8.2 x64 / Windows 10.