[Numpy-discussion] ndarray: How to create and initialize with a value other than ones or zeros?
monocongo at gmail.com
Thu Jun 6 15:56:06 EDT 2013
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
Thanks in advance for your help with this issue.
More information about the NumPy-Discussion