반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Excel
- Google Spreadsheet
- Github
- gas
- PANDAS
- dataframe
- Kotlin
- PostgreSQL
- 파이썬
- Redshift
- SQL
- Python
- google apps script
- Tkinter
- numpy
- Mac
- matplotlib
- GIT
- Apache
- hive
- c#
- array
- Java
- list
- django
- PySpark
- string
- Google Excel
- math
Archives
- Today
- Total
목록pandas count distinct (1)
달나라 노트
Python Pandas : nunique() (count distinct, 중복없는 값 세기, unique한 값의 개수 세기, pandas count distinct, DataFrame count distinct)
nunique() method는 DataFrame이나 Series에 있는 값들 중 중복값을 제거한 unique한 값의 개수를 return합니다. 바로 예시를 봅시다. import pandas as pd df_test = pd.DataFrame( { 'col1': [1, 1, 3, 3, 4, 4, 4], 'col2': [8, 8, 8, 8, 8, 9, 9], } ) print(df_test) nunique_result = df_test.nunique() print(nunique_result) print(type(nunique_result)) -- Result col1 col2 0 1 8 1 1 8 2 3 8 3 3 8 4 4 8 5 4 9 6 4 9 col1 3 col2 2 dtype: int64 df_t..
Python/Python Pandas
2023. 10. 24. 23:23