Skip to content Skip to sidebar Skip to footer

Fanccy Indexing Vs View In Numpy Part Ii

Fancy Indexing vs Views in Numpy In an answer to this equation: is is explained that different idioms will produce different results. Using the idiom where fancy indexing is to ch

Solution 1:

Python evaluates each set of [] separately. a[x, :][:, y] = 100 is 2 operations.

temp = a[x,:]           # getitem steptemp[:,y] = 100         # setitem step

Whether the 2nd line ends up modifying a depends on whether temp is a view or copy.

Remember, numpy is an addon to Python. It does not modify basic Python syntax or interpretation.

Post a Comment for "Fanccy Indexing Vs View In Numpy Part Ii"