Код: Выделить всё
import numpy as np
x = np.arange(25).reshape(5, 5)
print(x.base)
y = x[:2, [0, 2]]
print(y.base)
Код: Выделить всё
[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
24]
[[0 5]
[2 7]]
Другой пример:
Код: Выделить всё
>>> import numpy as np
>>> x = np.arange(25).reshape(5, 5)
>>> x[:2, [0,2]].base
array([[0, 5],
[2, 7]])
>>> x[[0,2], :2].base
>>>
Подробнее здесь: https://stackoverflow.com/questions/792 ... d-indexing
Мобильная версия