Workaround for datetime timestamp() on windows for dates preceeding 1970-01-01
问题 I am currently trying to generate numerical features in a dataset by converting the dates to timestamps. If run on Mac, it works flawlessly, on windows it throws an OS Error: [Errno 22] Invalid argument which is probably due to windows not supporting unix timestamps from before 1970-01-01. I have dates from 1955 upwards. Here is my code: import time import datetime current_timestamp = time.time() df.loc[:, "FEATURE_num"] = df["FEATURE"].apply(lambda d: datetime.datetime.strptime(d, '%Y-%m-%d'