numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
append(arr, values, axis=None)

Parameters

arr : array_like

Values are appended to a copy of this array.

values : array_like

These values are appended to a copy of :None:None:`arr`. It must be of the correct shape (the same shape as :None:None:`arr`, excluding :None:None:`axis`). If :None:None:`axis` is not specified, :None:None:`values` can be any shape and will be flattened before use.

axis : int, optional

The axis along which :None:None:`values` are appended. If :None:None:`axis` is not given, both :None:None:`arr` and :None:None:`values` are flattened before use.

Returns

append : ndarray

A copy of :None:None:`arr` with :None:None:`values` appended to :None:None:`axis`. Note that append does not occur in-place: a new array is allocated and filled. If :None:None:`axis` is None, :None:None:`out` is a flattened array.

Append values to the end of an array.

See Also

delete

Delete elements from an array.

insert

Insert elements into an array.

Examples

This example is valid syntax, but we were not able to check execution
>>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]])
array([1, 2, 3, ..., 7, 8, 9])

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

This example is valid syntax, but we were not able to check execution
>>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0)
array([[1, 2, 3],
       [4, 5, 6],
       [7, 8, 9]])
This example is valid syntax, but we were not able to check execution
>>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0)
Traceback (most recent call last):
    ...
ValueError: all the input arrays must have same number of dimensions, but
the array at index 0 has 2 dimension(s) and the array at index 1 has 1
dimension(s)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.append numpy.ma.core.append numpy.delete numpy.insert dask.array.routines.append

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/lib/function_base.py#5337
type: <class 'function'>
Commit: