I have a numpy array with some random numbers, how can I create a new array with the same size and fill it with a single value?
I have the following code:
A=np.array([[2,2],
[2,2]])
B=np.copy(A)
B=B.fill(1)
I want to have a new array B with the same size as A but filled with 1s. However, it returns a None
object. Same when using np.full
.