[Numpy-discussion] ndarray: How to create and initialize with a value other than ones or zeros?
ewm at redtetrahedron.org
Thu Jun 6 18:12:10 EDT 2013
James Adams wrote:
> I would like to create an array object and initialize the array's
> values with an arbitrary fill value, like you can do using the ones()
> and zeros() creation routines to create and initialize arrays with
> ones or zeros. Is there an easy way to do this? If this isn't
> possible then what is the most efficient way to initialize a numpy
> array with an arbitrary fill value?
> In order to provide such an array creation routine I can imagine that
> it'd be as simple as taking the code for ones() and/or zeros() and
> modifying that code so that it provides an additional fill value
> argument and then within the section which does the initialization of
> the array it could use that fill value instead of 1 or 0. Is this a
> naive assumption?
> Thanks in advance for your help with this issue.
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
There's also https://github.com/numpy/numpy/pull/2875 in the queue.
More information about the NumPy-Discussion