[AIVLE SCHOOL] 데이터 분석 (4) - 단변량 분석2

춤추는 머쉬룸·2024년 9월 26일

AIVLE SCHOOL 6기

목록 보기
26/80
post-thumbnail

9/26 3세션

A. 범주형 변수 분석

범주별 개수(Count)를 센다

A-1. 범주별 요약

  • 빈도수 : 시리즈.value_counts()
  • 비율 : 시리즈.value_counts(normalize= True)

A-2. 범주형 변수 시각화

막대그래프

  • sns.countplot() 형태로 사용
  • 자동으로 집계 후, 집계한 결과로 시각화
# seaborn 사용
sns.countplot(x=titanic['Pclass'])

sns.countplot(x='Pclass', data=titanic) # 세로 막대
sns.countplot(y='Pclass', data=titanic) # 가로 막대

plt.grid()
plt.show()

0개의 댓글