How to measure the time of creating a numpy array with for loop in Python

1 Answer

0 votes
from time import process_time
import numpy as np

start = process_time()

arr = np.array([i for i in range(10000)])

end = process_time()

print(end - start)

 
 
 
 
'''
run:

0.0025002939999999862

'''

 



answered Mar 3, 2023 by avibootz

Related questions

1 answer 202 views
1 answer 198 views
1 answer 223 views
223 views asked Jun 26, 2018 by avibootz
1 answer 157 views
157 views asked May 29, 2023 by avibootz
1 answer 125 views
...