개발공부

[Python] Numpy 중복 제거 unique() 본문

Python/Numpy

[Python] Numpy 중복 제거 unique()

mscha 2022. 4. 29. 17:20

np.unique()

 -중복된 값을 제거한다.

 - set과 유사한 기능을 한다.

>>> x = np.array([1, 5, 3, 1, 40, 22, 33, 56, 12, 1, 5, 3])
>>> x
array([ 1,  5,  3,  1, 40, 22, 33, 56, 12,  1,  5,  3])
>>> np.unique(x)
array([ 1,  3,  5, 12, 22, 33, 40, 56])