요인 관계와 분포

Python으로 하는 탐색적 데이터 분석

Izzy Weber

Curriculum Manager, DataCamp

교육 수준: 남성 파트너

divorce["education_man"].value_counts()
Professional    1313
Preparatory      501
Secondary        288
Primary          100
None               4
Other              3
Name: education_man, dtype: int64
Python으로 하는 탐색적 데이터 분석

범주형 관계 탐색

sns.histplot(data=divorce, x="marriage_duration", binwidth=1)
plt.show()

Histogram of marriage duration

Python으로 하는 탐색적 데이터 분석

범주형 관계 탐색

sns.histplot(data=divorce, x="marriage_duration", hue="education_man", binwidth=1)
plt.show()

Histogram of marriage duration color coded by education_man

Python으로 하는 탐색적 데이터 분석

커널 밀도 추정(KDE) 그래프

sns.kdeplot(data=divorce, x="marriage_duration", hue="education_man")
plt.show()

marriage duration kde with hue set to education_man

Python으로 하는 탐색적 데이터 분석

커널 밀도 추정(KDE) 그래프

marriage duration kde with hue set to education_man, zoomed in to marriage_duration of zero

Python으로 하는 탐색적 데이터 분석

커널 밀도 추정(KDE) 그래프

sns.kdeplot(data=divorce, x="marriage_duration", hue="education_man", cut=0)
plt.show()

marriage duration kde with hue set to education_man and cut equal to zero

Python으로 하는 탐색적 데이터 분석

누적 KDE 그래프

sns.kdeplot(data=divorce, x="marriage_duration", hue="education_man", cut=0, cumulative=True)
plt.show()

marriage duration cumulative distribution function with hue set to education_man and cut equal to zero

Python으로 하는 탐색적 데이터 분석

결혼 연령과 교육의 관계

  • 결혼 연령과 교육 수준 사이에 관계가 있나요?
divorce["man_age_marriage"] = divorce["marriage_year"] - divorce["dob_man"].dt.year
divorce["woman_age_marriage"] = divorce["marriage_year"] - divorce["dob_woman"].dt.year
Python으로 하는 탐색적 데이터 분석

범주형 변수가 있는 산포도

sns.scatterplot(data=divorce, x="woman_age_marriage", y="man_age_marriage")
plt.show()

A scatterplot of woman_age_marriage and man_age_marriage

Python으로 하는 탐색적 데이터 분석

범주형 변수가 있는 산포도

sns.scatterplot(data=divorce, 
                x="woman_age_marriage",
                y="man_age_marriage", 
                hue="education_man")
plt.show()

A scatterplot of woman_age_marriage and man_age_marriage with hue set to education_man

Python으로 하는 탐색적 데이터 분석

연습해 봅시다!

Python으로 하는 탐색적 데이터 분석

Preparing Video For Download...