Articles → NUMPY → Broadcast Capability Of An Array In Numpy
Broadcast Capability Of An Array In Numpy
Example
import numpy as np
arr = np.arange(0,10)
# print array
print("Before change", arr)
#Broadcast
arr[0:2] = 200
# print array
print("After change", arr)
Click to Enlarge
Changing The Value Of All The Elements In One Go
import numpy as np
arr = np.arange(0,10)
arr[:] = 100
# print array
print(arr)
Click to Enlarge