IT_developers

Python 데이터 분석(주피터노트북) - Seaborn(distribution plots) 본문

Python

Python 데이터 분석(주피터노트북) - Seaborn(distribution plots)

developers developing 2022. 11. 27. 14: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')

 

아이리스 데이터 생성

 

1. histplot

  • bins : 구간 설정
  • kde : 밀도에 대한 선
  • stat : 밀도 형태로 출력

에러

hue : 옵션을 줄 때 데이터를 다 조회

ValueError: The following variable cannot be assigned with wide-form data: `hue`

 

2. joinplot

  • 산점도 + 히스토그램
  • 종류 변경 가능

Comments