Skip to main content

np.append()

np.append(arr, value)

A copy of arr with value appended to the end. This does not change arr unless you store the result in arr.

Input:
arr : array
The original array to which a value will be appended.
value : any type
The value to append to the array.
Returns:
new_arr - a new array containing the elements of the original array followed by the appended value
Return Type:
array

np.append(weight_arr, 2)

array([40. , 1.5 , 15. , 80. , 25. , 1. , 0.25, 10. , 2. ])