I'm learning to use Numpy and I wanted to see the speed difference in the summation of a list of numbers so I made this code:
np_array = numpy.arange(1000000)
start = time.time()
sum_ = np_array.sum()
print time.time() - start, sum_
>>> 0.0 1783293664
python_list = range(1000000)
start = time.time()
sum_ = sum(python_list)
print time.time() - start, sum_
>>> 0.390000104904 499999500000
The python_list sum is correct.
If I do the same code with the summation to 1000, both print the right answer. Is there an upper limit to the length of the Numpy array or is it with the Numpy sum function?
Thanks for your help