I am trying to understand a specific part of this article.
The definition of advanced indexing means that
x[(1,2,3),]is fundamentally different thanx[(1,2,3)]. The latter is equivalent tox[1,2,3]which will trigger basic selection while the former will trigger advanced indexing. Be sure to understand why this occurs.
I have experimented with the following code.
>>> import numpy as np
>>> a = np.arange(50).reshape(5,10)
>>> b = a[(2,2)]
>>> bb = a[(2,2),]
>>> a[2,2] = 50 # a[2,2] was 22 in the first place
>>> b
22 # this outcome confuses me!
I think b = a[(2,2)] would get a view so when I change a[2,2] this would do so.
bb = a[(2,2),] would receive the copy so nothing would happen even if I do something on a.
But as I change a[2,2] from 22 to 50
What I expect b = a[(2,2)] would change to 50 a and bb = a[(2,2),] is going to remain the same.
What's wrong with all of this? Am I misunderstanding or missing something important?
If it is, Please correct me and thank in advance!