I was reading on this thread on StackOverflow about the difference between a numpy array of zeros and empty.

Does it make much difference when initializing an array? I decided to play around with Python’s timeit to see the time difference.

import timeit
import numpy as np

We can initialize a big number to put into our loop first.

big = 10**6; big
1000000

And then move on to timing our array initializations.

%timeit np.empty([big, big])
17.7 ms ± 150 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
%timeit np.zeros([big, big])
17.6 ms ± 208 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

Although there is a difference, it doesn’t seem to be much.