: Matplotlib 패키지에서 지원하지 않는 고급 통계 차트를 그리는 통계용 시각화 기능을 제공
!pip install -U seaborn
import seaborn as sns
hue = '열 이름': 해당 열별로 나누어 보여줌multiple = 'fill': 사각형 가득 채워서 그려줌sns.scatterplot(x = '열1 이름', y = '열2 이름', data = 데이터명)sns.scatterplot('열1 이름', '열2 이름', data = 데이터명)
sns.histplot(data = 데이터명, x='열1', bins = n)


sns.kdeplot(데이터명['열 이름'])sns.kdeplot(x='total_bill', data = 데이터명, hue ='time', common_norm = False)
plt.show()


sns.distplot(데이터명['열 이름'], hist = True, bins = 16): 히스토그램과 KDE를 한꺼번에 겹쳐서 볼 수 있음
sns.boxplot(data = 데이터명, y = '열1 이름'): y 방향으로sns.countplot(Mid_Test['Math']): 집계와 bar 차트 기능을 한꺼번에.sns.pairplot(데이터명): 숫자형 변수들의 산점도를 한꺼번에 보여준다. 수가 많은 만큼 출력 시간이 길다.sns.jointplot(x='열1 이름', y='열2 이름', data = 데이터명): 산점도와 히스토그램을 동시에
sns.countplot(x="열1 이름", data=데이터명): Matplotlib에서는 bar plot을 그릴때, 반드시 집계가 선행되어야 하지만, seaborn의 countplot 은 집계를 포함하여 barplot을 그려준다.sns.barplot(x="열1 이름", y="열2 이름", data = 데이터명): 막대 길이는 평균을 나타내고, error bar는 신뢰구간을 나타낸다
df.groupby(by = ['column1', 'column2'], as_index = False)['column3'].count()
df.pivot('column1', 'column2', 'column3'): index, columns, values 순서대로 데이터를 재구성하여 나타냄
변환 전
| index | columns | values |
|---|---|---|
| 1 | col1 | 10 |
| 2 | col1 | 20 |
| 1 | col2 | 30 |
| 2 | col2 | 40 |
pivot으로 변환 후
| index | col1 | col2 |
|---|---|---|
| 1 | 10 | 30 |
| 2 | 20 | 40 |
sns.heatmap(data명, annot = True, fmt = 'd', linewidth = .2): 색상으로 표현할 수 있는 다양한 정보를 일정한 이미지위에 열분포 형태의 비쥬얼한 그래픽으로 출력