Name
put
Synopsis
put(a
,indices
,values
)
a
must be a contiguous array.
indices
is a sequence of integers, taken
as indices into a
.flat
.
values
is a sequence of values that can be
converted to a
’s type
code (if shorter than indices
,
values
is repeated as needed). Each
element of a
indicated by an item in
indices
is replaced by the corresponding
item in values
. put
is
therefore similar to (but faster than) the loop:
for i,v in zip(indices,values*len(indices)): a.flat[i]=v
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.