-
[python] 유일값 보기 unique() 함수Python_AI and Bigdata 2022. 9. 25. 01:32728x90
변수의 유일값들을 보고 싶다면 unique()함수를 쓰시면 됩니다.
데이터 분석할 때 정~~말 많이 쓰이는 함수입니다.
iris["Species"].unique()
Out[75]:array(['setosa', 'versicolor', 'virginica'], dtype=object)
Iris 종은 총 setosa, versicolor, virginica 3 종류가 있는 것을 확인할 수 있습니다.
iris["Species"].nunique()
Out[78]:3
nunique()함수를 쓰면 총 유일값이 몇개인지 확인할 수 있습니다!
'Python_AI and Bigdata' 카테고리의 다른 글
[python] 중복제거 drop_duplicates() (0) 2022.09.28 [python] 변수 제거 drop() 함수 (0) 2022.09.26 [python] 테이블의 변수 목록 확인하기 (0) 2022.09.24 [python] 데이터프레임 행,열 확인하기 shape() 함수 (2) 2022.09.22 [python] 데이터프레임을 볼 수 있는 행/열 개수 지정하기 (0) 2022.09.22