[Numpy-discussion] New numpy functions: filled, filled_like

Robin robince@gmail....
Mon Jan 14 09:21:57 CST 2013

On Mon, Jan 14, 2013 at 2:57 PM, Benjamin Root <ben.root@ou.edu> wrote:
> I am also +1 on the idea of having a filled() and filled_like() function (I
> learned a long time ago to just do a = np.empty() and a.fill() rather than
> the multiplication trick I learned from Matlab).  However, the collision
> with the masked array API is a non-starter for me.  np.const() and
> np.const_like() probably make the most sense, but I would prefer a verb over
> a noun.

To get an array of 1's, you call np.ones(shape), to get an array of
0's you call np.zeros(shape) so to get an array of val's why not call
np.vals(shape, val)?



More information about the NumPy-Discussion mailing list