I'm trying to convert pandas dataframe into SPSS format and have an issue converting a datetime64 variable.
Using the following codes:
import pandas as pd
import datetime as dt
df['date1'] = (df['date'] - pd.Timestamp('1582-10-15 00:00')).astype('timedelta64[s]')
or
df['date1'] = (df['date'] - dt.datetime(1582, 10, 15)).astype('timedelta64[s]')
I get Out of bounds nanosecond timestamp: 1582-10-15 00:00:00
error.
When I just try for fun to use 1982 instead, it works!
I know there is a hard way to go to epoch from 1582 to 1970 and utc time etc, but is there an easy way? Thank you very much!