월별 출생건수 (1) - 한국 사례
월 별 출생 수를 통해 출생과 관련된 요소가 있는지 알아보겠습니다.
■ 데이터 출처
UN에서 제공한 월별 출생 데이터를 통해 전세계의 출생 건수를 파악
http://data.un.org/Data.aspx?d=POP&f=tableCode%3A55
UNdata | record view | Live births by month of birth
Demographic Statistics Database The United Nations Statistics Division collects, compiles and disseminates official demographic and social statistics on a wide range of topics. Data have been collected since 1948 through a set of questionnaires dispatched
data.un.org
이 페이지에서는 한국을 대상으로 분석을 진행
■ 데이터 필드
2015~2019년도 5년간의 월별 출생건수에 대한 데이터로 국가명, 년도, 월, 출생건수 총 4가지로 구성
■ 출산이 가장 많은 달은?
출산 건수가 제일 많은 달은 1월로 뒤이어 3월이 나타났다. 출산건수가 제일 적은 달은 12월로 그이어 11월로 나타났다. 특징적인 요소만 살펴보자면 1월, 3월에 유독 많고 12월, 11월에 유독 적은 양상이 나타난다. 또한 12월과 1월 한 달 사이의 차이가 5만이나 발생한다는 점은 주목할 만한 부분이다.
■ 출산시기(결과)보다 임신시기(원인)가 위 출산 패턴에 영향을 주는 지 알아보자.
임신시기에 대한 계산법으로
임신하는 달 = 출산하는 달 - 임신기간
※ 임신 기간은 9개월(실제 임신기간은 266일)
위의 계산법을 통해 4월에 임신을 가장 많이한 것으로 나타나며 연초(1~3)월이 제일 임신이 적고 봄~초여름에 임신을 많은 것으로 보인다.
다음 페이지에서는 외국 국가들의 출산시기에 대해 알아보자.
- 코드
## import modules
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import font_manager,rc
import matplotlib
font_path = 'C:\\Windows\\Fonts\\gulim.ttc'
#폰트 이름 얻어오기
font_name = font_manager.FontProperties(fname=font_path).get_name()
#font 설정
matplotlib.rc('font',family=font_name)
## update Data
df = pd.read_csv("C:\\Users\\USER\\Desktop\\Data\\birth_date\\birth_month_korea.csv")
def find_birth_month(df):
df = df.groupby('Month')['Value'].sum()
df = df.sort_values()
df_birth = pd.DataFrame(df)
df_birth = df_birth[:-1] # Delete Total
df_birth.reset_index(inplace=True)
# Month -> 한글 '월' 로 변경
df_birth['birth_month'] = df_birth['Month'].map({'January':'1월',
'February':'2월',
'March':'3월',
'April':'4월',
'May':'5월',
'June':'6월',
'July':'7월',
'August':'8월',
'September':'9월',
'October':'10월',
'November':'11월',
'December':'12월'})
df_birth = df_birth.sort_values(by='Value' ,ascending=False)
df_birth['Pregnant_Month'] = df_birth['birth_month']
# 값을 대체하기 ex) 12월 -> 3월, 1월 -> 4월
df_birth['Pregnant_Month'] = df_birth['Pregnant_Month'].map({'1월':'4월',
'2월':'5월',
'3월':'6월',
'4월':'7월',
'5월':'8월',
'6월':'9월',
'7월':'10월',
'8월':'11월',
'9월':'12월',
'10월':'1월',
'11월':'2월',
'12월':'3월'})
return df_birth