Fancy Indexing Vs Views In Numpy
I'm confused by another part of the article in the attached link: https://scipy-cookbook.readthedocs.io/items/ViewsVsCopies.html In the section 'But fancy indexing does seem to ret
Solution 1:
The reason is the way Python works.
The first statement calls the setitem
method, the second getitem
. The first one doesn't create a new object, but the second will (for fancy indexing, it will create a view for regular indexing).
And of course, we want this behavior so that we can set some values in an array that are not "regular" and where a view would not work.
Post a Comment for "Fancy Indexing Vs Views In Numpy"