Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'numpy.ndarray' object has no attribute 'clock'

Here is the way I try to calculate the time for CPU in Window.

start_time_1 = time.clock()
coupl.setParareal(pr)
pr.initialize(y1d_init)
pr.iterate()
y1d_pr = pr.state_mic
end_time_1 = time.clock()

Can someone help me to get rid of this error?

like image 679
Mian Avatar asked Dec 25 '22 06:12

Mian


2 Answers

Probably you created a numpy array named time somewhere before this code snippet. You should not do that, because the module time now gets overwritten. Rename your array (to something like time_list), and it works.

like image 167
Mathias711 Avatar answered Dec 26 '22 20:12

Mathias711


I have similar question like this. The error occurs as below

'numpy.ndarray' object has no attribute 'asctime'

That means you have created an array named 'time', so in order to avoid the conficts between Keywords and Variables etc.We have to identify every variable's name and be cautious when import xx as xx

like image 25
J.Gu Avatar answered Dec 26 '22 20:12

J.Gu