NumPy View vs Copy
Interview insights are lockedSee how often this is asked and which companies asked it with Buncho Pro.What is the difference between a view and a copy in NumPy? What does this print?
a = np.array([1, 2, 3, 4])
view = a.view()
copy = a.copy()
view[0] = 100
print(a)
print(copy)
Hints
Related questions
- NumPy Views vs CopiesMedium