This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import time | |
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') | |
timeStamp = pd.Series(timestamp) | |
data['Timestamp'] = timeStamp.values | |
final_data = data.drop(['Date', 'Time'], axis=1) | |
final_data = final_data[final_data.Timestamp != 'ValueError'] | |
final_data.head() |
OverflowError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_1584\2811706222.py in
6 try:
7 ts = datetime.datetime.strptime(d+' '+t, '%m/%d/%Y %H:%M:%S')
----> 8 timestamp.append(time.mktime(ts.timetuple()))
9 except ValueError:
10 # print('ValueError')
OverflowError: mktime argument out of range
Any way there's a fix?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"OverflowError: mktime argument out of range" Any way there's a fix?