I have an large 2D array contains seconds from year 2000, I want to convert to an array of datetime. I could not find a good way to do it. I used a loop. But it did not work and it produced an error as: TypeError: float() argument must be a string or a number, not 'datetime.datetime'
I give the example code as below. Would you please give me any suggestions? Thank you.
import numpy as np
import datetime as dt
secs_from_2000 = np.array([[6.833232e+08, 6.833233e+08, 6.833235e+08], [6.833239e+08, 6.833242e+08, 6.833244e+08]])
dt_from_1970 = np.empty_like(secs_from_2000)
for i in range(secs_from_2000.shape[0]):
for j in range(secs_from_2000.shape[1]):
dt_from_1970[i,j] = dt.datetime.utcfromtimestamp((dt.datetime(2000,1,1)- dt.datetime(1970,1,1)).total_seconds() + secs_from_2000[i,j])