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 |
Tags
- tableau
- 데이터 분석
- 시각화
- Deep Learning Specialization
- SQLD
- 코딩테스트
- 파이썬
- ML
- matplotlib
- IRIS
- Google ML Bootcamp
- 머신러닝
- SQL
- 회귀분석
- pandas
- Python
- 데이터분석준전문가
- 데이터 전처리
- 딥러닝
- r
- scikit learn
- 자격증
- 데이터분석
- ADsP
- sklearn
- 태블로
- pytorch
- 이것이 코딩테스트다
- 통계
- 이코테
Archives
- Today
- Total
함께하는 데이터 분석
[Python] get_dummies() 본문
라이브러리 불러오기
import pandas as pd
import seaborn as sns
Seaborn을 활용하여 데이터 불러오기
mpg = sns.load_dataset('mpg')
mpg.head()
mpg=mpg.drop(columns='name')
mpg.head()
mpg['origin'].value_counts()
>>> usa 249
japan 79
europe 70
Name: origin, dtype: int64
usa, japan, europe 3개의 값으로 origin 칼럼이 구성되어있음
get_dummies()
pd.get_dummies(mpg)
get_dummies()를 사용하여 간단하게 One-Hot Encoding을 한 것을 확인할 수 있음
결측 값이 존재한다면 dummy_na=True 옵션을 사용하면 NaN열도 생성됨
'데이터분석 공부 > Python' 카테고리의 다른 글
[Python] excel, csv, tsv 불러오기 및 저장하기 (0) | 2022.09.04 |
---|---|
[Python] Matplotlib 여러 개의 그래프 한번에 그리기 (0) | 2022.04.14 |
[Python] Matplotlib violinplot 그리기 (0) | 2022.04.12 |
[Python] Matplotlib boxplot 그리기 (0) | 2022.04.12 |
[Python] Matplotlib 파이 차트 그리기 (0) | 2022.04.09 |