ndarray.itemset()
numpy.ndarray.itemset
-
ndarray.itemset(*args)
-
Insert scalar into an array (scalar is cast to array’s dtype, if possible)
There must be at least 1 argument, and define the last argument as item. Then,
a.itemset(*args)
is equivalent to but faster thana[args] = item
. The item should be a scalar value andargs
must select a single item in the arraya
.Parameters: *args : Arguments
If one argument: a scalar, only used in case
a
is of size 1. If two arguments: the last argument is the value to be set and must be a scalar, the first argument specifies a single arra