Let's say I want to store datetime values over 100 iterations of a for loop in a numpy array like so:
import numpy as np
import time
from datetime import datetime
Startmult = np.zeros((1,100))
for i in range(100):
Startmult[i] = datetime.now()
Whenever I do this, I get the following error:
float() argument must be a string or a number, not 'datetime.datetime'
Is there a way to overcome this error?
Thank you for your help!
EDIT: Also, now I would like to do the following, but can't seem to find a solution:
CPUtime = np.zeros((100), dtype='datetime64[s]')
for i in range(100):
Start = datetime.now()
CPUtime[i] = datetime.now()-Start
In now get the following error:
Could not convert object to NumPy datetime