Ellipsis 객체는 원래 ndarray의 indexing과 slicing을 도와주는 객체이다.
사이트에 적힌 원문을 번역해보면,
모든 차원을 인덱싱하기 위해 선택 튜플에 필요한 개체 수로 확장한다는 말인데.. 일단 보자!
numpy.org/doc/stable/reference/arrays.indexing.html
Indexing — NumPy v1.19 Manual
Indexing ndarrays can be indexed using the standard Python x[obj] syntax, where x is the array and obj the selection. There are three kinds of indexing available: field access, basic slicing, advanced indexing. Which one occurs depends on obj. Note In Pyth
numpy.org
1) 단독으로 사용했을 때 arr == arr[...]
: 왜냐하면 Ellipsis 객체로 모든 차원을 선택했기 때문이다.

2) '...' vs ':'의 차이
: 아직 이해를 못한 것 같다...

3) 2D Array

4) 3D Array
: '...'는 index에서 딱 한 번만 사용할 수 있다. 여러 Ellipsis를 사용하면 error가 난다.

'ML&AI > 관련 python, lib 문법' 카테고리의 다른 글
numpy.ndarray.astype (0) | 2021.01.27 |
---|---|
np.linspace() (0) | 2021.01.27 |
np.random.rand() (0) | 2021.01.27 |