Issue with current documentation:
It looks like there is an implicit behavior which is not documented in advanced and basic combined index.
Below is the reproducing code:
>>> x = np.arange(0, 12).reshape(2, 3, 2)
>>> y = x[0:2, [0, 1], 0:2]
>>> y.base
array([[[0, 1],
[6, 7]],
[[2, 3],
[8, 9]]])
>>> y.shape, y.strides
((2, 2, 2), (16, 32, 8))
y is created using advanced indexing.
Particularly, because the index [0:2, [0, 1], 0:2] contains both slice and list, this is called Combining advanced and basic indexing.
The point is because this is a kind of advanced indexing, this should return a copy of data. This is documented.
Advanced indexing always returns a copy of the data (contrast with basic slicing that returns a view).
However, in above example code, y is not a copy of data but view because it has non-None y.base .
I want when and how this behavior happens documented.
I want to contribute to this issue if possible, but I cannot because I also don't understand when and how this behavior happens.
Idea or request for content:
No response
Issue with current documentation:
It looks like there is an implicit behavior which is not documented in advanced and basic combined index.
Below is the reproducing code:
yis created using advanced indexing.Particularly, because the index
[0:2, [0, 1], 0:2]contains both slice and list, this is called Combining advanced and basic indexing.The point is because this is a kind of advanced indexing, this should return a copy of data. This is documented.
However, in above example code,
yis not a copy of data but view because it has non-Noney.base.I want when and how this behavior happens documented.
I want to contribute to this issue if possible, but I cannot because I also don't understand when and how this behavior happens.
Idea or request for content:
No response