MCPcopy Create free account
hub / github.com/numpy/numpy / append

Function append

numpy/ma/core.py:8525–8565  ·  view source on GitHub ↗

Append values to the end of an array. .. versionadded:: 1.9.0 Parameters ---------- a : array_like Values are appended to a copy of this array. b : array_like These values are appended to a copy of `a`. It must be of the correct shape (the same shape as

(a, b, axis=None)

Source from the content-addressed store, hash-verified

8523
8524
8525def append(a, b, axis=None):
8526 """Append values to the end of an array.
8527
8528 .. versionadded:: 1.9.0
8529
8530 Parameters
8531 ----------
8532 a : array_like
8533 Values are appended to a copy of this array.
8534 b : array_like
8535 These values are appended to a copy of `a`. It must be of the
8536 correct shape (the same shape as `a`, excluding `axis`). If `axis`
8537 is not specified, `b` can be any shape and will be flattened
8538 before use.
8539 axis : int, optional
8540 The axis along which `v` are appended. If `axis` is not given,
8541 both `a` and `b` are flattened before use.
8542
8543 Returns
8544 -------
8545 append : MaskedArray
8546 A copy of `a` with `b` appended to `axis`. Note that `append`
8547 does not occur in-place: a new array is allocated and filled. If
8548 `axis` is None, the result is a flattened array.
8549
8550 See Also
8551 --------
8552 numpy.append : Equivalent function in the top-level NumPy module.
8553
8554 Examples
8555 --------
8556 >>> import numpy.ma as ma
8557 >>> a = ma.masked_values([1, 2, 3], 2)
8558 >>> b = ma.masked_values([[4, 5, 6], [7, 8, 9]], 7)
8559 >>> ma.append(a, b)
8560 masked_array(data=[1, --, 3, 4, 5, 6, --, 8, 9],
8561 mask=[False, True, False, False, False, False, True, False,
8562 False],
8563 fill_value=999999)
8564 """
8565 return concatenate([a, b], axis)

Callers

nothing calls this directly

Calls 1

concatenateFunction · 0.70

Tested by

no test coverage detected