I've heard numpy is much faster than core python lists in case of manipulation speed . but when I ran these pieces of code I got oposite. Can anyone explain to me how this happens ?
def pure_py_list():
"""to see speed of normal python lists"""
t1 = time.time()
total = 0
x = range(10000000)
for item in x :
total+=1
t2 = time.time()
return (t2 - t1)
def numpy_list ():
"""calculating speed of numpy arrays ."""
t1 = time.time()
total = 0
x = np.arange(10000000)
for element in x :
total +=1
t2 = time.time()
return (t2 - t1)
thanks a lot.