Best way to initialize and fill an numpy array?
Best way to initialize and fill an numpy array? Question: I want to initialize and fill a numpy array. What is the best way? This works as I expect: >>> import numpy as np >>> np.empty(3) array([ -1.28822975e-231, -1.73060252e-077, 2.23946712e-314]) But this doesn’t: >>> np.empty(3).fill(np.nan) >>> Nothing? >>> type(np.empty(3)) <type ‘numpy.ndarray’> It seems to me …