↧
Answer by Paul Panzer for Why does operating on what seems to be a copy of...
While statements a = expr and a[x] = expr look similar, they are actually fundamentally different. The first binds the name 'a' to expr. The second is more or less equivalent to a.__setitem__(x, expr)....
View ArticleAnswer by Batman for Why does operating on what seems to be a copy of data...
The key point here is Advanced indexing always returns a copy of the data In your second example you're not using the index to return anything. You're only using the index to modify the values. So the...
View ArticleWhy does operating on what seems to be a copy of data modify the original data?
Let's quote numpy manual: https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#advanced-indexing Advanced indexing is triggered when the selection object, obj, is a non-tuple sequence...
View Article