mxnet.np.append

append(arr, values, axis=None)

Append values to the end of an array.

Parameters
  • arr (ndarray) – Values are appended to a copy of this array.

  • values (ndarray) – 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.

Returns

append – 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, out is a flattened array.

Return type

ndarray

Examples

>>> np.append(np.array([1, 2, 3]), np.array([[4, 5, 6],[7, 8, 9]]))
array([1., 2., 3., 4., 5., 6., 7., 8., 9.])

When axis is specified, values must have the correct shape.

>>> np.append(np.array([[1, 2, 3], [4, 5, 6]]), np.array([[7, 8, 9]]), axis=0)
array([[1., 2., 3.],
       [4., 5., 6.],
       [7., 8., 9.]])