Python
Python 데이터 분석(주피터노트북) - Seaborn(범주형 시각화)
developers developing
2022. 11. 26. 17:00
라이브러리 및 세팅
- import seaborn as sns
- seaborn 폰트 사용 - 한글처리보다 먼저 선언해야함
- sns.set(font_scale=1)
- import pandas as pd
- import matplotlib.pyplot as plt
- 한글처리
- plt.rcParams['font.family'] = 'Malgun Gothic'
- plt.rcParams['axes.unicode_minus'] = False
- 경고 메세지
- import warnings
- warnings.simplefilter("ignore")
- seaborn 스타일의 그래프를 사용
- plt.style.use('seaborn')
데이터 생성
describe() : 수치형 기술 통계 값 확인
1. boxplot
orient = 'h' : 수평
2. swarmplot : 모든 데이터를 점을 찍어 표시
- 찍을 점이 많을 시 경고 메세지가 뜰 수 있음.
- size를 지정
3. catplot
- swarmplot보다 뭉처진 느낌
4. violinplot
5. stripplot : catplot과 비슷한 모양
6. countplot
- 타이타닉 데이터
- null 값 확인
1) 성별 차트
- pandas
- seaborn
2) 성별 인원수를 객실 등급별로 시각화
- pandas
- seaborn