To add data from a new numpy.ndarray
at the end of another numpy.ndarray
in Python, you can use the numpy.append()
function. Here is an example:
main.py233 chars13 lines
Output:
main.py14 chars2 lines
In the example above, we first create two numpy ndarrays arr1
and arr2
with different values. Then, we use the numpy.append()
function to append arr2
at the end of arr1
. The result is stored in the result
variable and printed.
Note that numpy.append()
returns a new array with the concatenated values, so we assigned it to a new variable (result
) to store the final result.
gistlibby LogSnag