- numpy.ma.append(a, b, axis=None)[source]¶
Append values to the end of an array.
New in version 1.9.0.
arr : array_like
Values are appended to a copy of this array.
values : array_like
These values are appended to a copy of arr. It must be of the correct shape (the same shape as arr, excluding axis). If axis is not specified, values can be any shape and will be flattened before use.
axis : int, optional
The axis along which values are appended. If axis is not given, both arr and values are flattened before use.
append : MaskedArray
A copy of arr with values appended to axis. Note that append does not occur in-place: a new array is allocated and filled. If axis is None, the result is a flattened array.
- Equivalent function in the top-level NumPy module.
>>> import numpy.ma as ma >>> a = ma.masked_values([1, 2, 3], 2) >>> b = ma.masked_values([[4, 5, 6], [7, 8, 9]], 7) >>> print(ma.append(a, b)) [1 -- 3 4 5 6 -- 8 9]