NumPy fill method on a scalar

26 Views Asked by At

In the following code

a = numpy.array([1,2,3])
b = a[0]
b.fill(5)
print(b)
print(a)

No error is raised. However, it prints 1 for b. I expected 5. Why this?

0

There are 0 best solutions below