简体   繁体   中英

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?

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.

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

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

'numpy.ndarray' object has no attribute 'asctime' That means you have create ana array nameed '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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM