ERROR : OverflowError: mktime argument out of range

Viewed 741
timestamp = []
for d, t in zip(data['Date'], data['Time']):
    try:
        ts = datetime.datetime.strptime(d+' '+t, '%m/%d/%Y %H:%M:%S')
        timestamp.append(time.mktime(ts.timetuple()))
    except ValueError:
        # print('ValueError')
        timestamp.append('ValueError')

ERROR : OverflowError: mktime argument out of range

this is from code earthquake prediction using machine learning

1 Answers

I wanted to prove the issue is reproducible: I will add to this if I find a solution.

import time, datetime
d = '04/04/1000'
t = '12:40:00'
dj = d + ' ' + t
ts = datetime.datetime.strptime(dj, '%m/%d/%Y %H:%M:%S')
time.mktime(ts.timetuple())
Related