MaskedArray.put(indices,values,mode='raise')[source]¶Set storage-indexed locations to corresponding values.
Sets self._data.flat[n] = values[n] for each n in indices.Ifvalues is shorter thanindices then it will repeat.Ifvalues has some masked values, the initial mask is updatedin consequence, else the corresponding values are unmasked.
| Parameters: |
|
|---|
Notes
values can be a scalar or length 1 array.
Examples
>>>x=np.ma.array([[1,2,3],[4,5,6],[7,8,9]],mask=[0]+[1,0]*4)>>>print(x)[[1 -- 3] [-- 5 --] [7 -- 9]]>>>x.put([0,4,8],[10,20,30])>>>print(x)[[10 -- 3] [-- 20 --] [7 -- 30]]
>>>x.put(4,999)>>>print(x)[[10 -- 3] [-- 999 --] [7 -- 30]]