-
2010~2020년 국내 시도별 예금은행 예금액 분석 with PythonData Analysis/Social Issues 2021. 4. 13. 16:15
이번 포스팅에서는 국가통계포털에서 제공하는 국내 시도별 예금은행 예금액 데이터를 갖고 분석하도록 하겠다. 역시 이번에도 파이썬을 통해서 만들도록 하겠다.
1. 2020년 시도별 1인당 예금은행 예금액(천원)
2020년 시도별 예금액을 시도별 인구수로 나눈 결과를 지도로 시각화해보았다.
역시나 서울시가 1인당 예금액이 가장 높게 나타났다.
from urllib.request import urlopen import json with urlopen('https://raw.githubusercontent.com/southkorea/southkorea-maps/master/kostat/2018/json/skorea-provinces-2018-geo.json') as response: kor = json.load(response) popu=pd.read_csv('C:/Users/banad/Downloads/popu.csv',encoding='cp949') df2=pd.merge(left=df_19,right=popu,how='inner',left_on=df_19['행정구역별'],right_on=popu['행정구역(시군구)별']) df2['Deposit per person(k)']=(df2['데이터']*1000000)/df2['총인구수 (명)'] for idx, si in enumerate(kor['features']): name=si['properties']['name'] nvm=df2.loc[(df2['행정구역별']==name),'Deposit per person(k)'].iloc[0] kor['features'][idx]['properties']['Deposit per person(k)']=int(nvm) kor['features'][idx]['properties']['base_year']=2020 import mapboxgl from mapboxgl.viz import * import os from mapboxgl.utils import create_color_stops from mapboxgl.utils import create_numeric_stops api='~~' center =[126.986, 37.565] color_breaks = [10000,20000,30000,40000,50000,60000,70000,80000,90000] color_stops =create_color_stops(color_breaks,colors='YlGnBu') viz =ChoroplethViz( access_token=api, data=kor, color_property='Deposit per person(k)', color_stops=color_stops, center=center, zoom=5.7, bearing=-11, pitch=43, height_property='Deposit per person(k)', height_stops=create_numeric_stops(color_breaks,0,10000), height_function_type='interpolate' ) viz.show() viz.create_html('deposit.html')
2. 2010년~2020년 시도별 예금액
전반적으로 모든 지역에서 예금액은 크게 연도별로 크게 차이 나지 않는데 서울, 경기도 수도권 지역에서만 유일하게 가파르게 증가하고 있다.
import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline %config InlineBackend.figure_format='retina' plt.rcParams["font.family"] = 'Malgun Gothic' sns.relplot(data=df,x='시점',y='데이터',kind='line',col='행정구역별',col_wrap=4)
3. 2020년 시도별 예금액
plt.rcParams["font.family"] = 'Malgun Gothic' df_19=df_19.rename(columns={'예금액':'예금액(십억)'}) ax=sns.catplot(data=df_19, x=df_19['행정구역별'], y='예금액(십억)', kind= 'bar', ci=None, palette='plasma', aspect=2.5,) ax.set_xticklabels(df_19['행정구역별'],fontfamily='Malgun Gothic', rotation=45,fontsize=10) for x,y in enumerate(list(df_19['예금액(십억)'])): plt.text(x, y, y, fontsize=10, color='#ff0000', horizontalalignment='center', verticalalignment='bottom') plt.title('시도별 총 예금액(십억)') plt.show()
'Data Analysis > Social Issues' 카테고리의 다른 글
국내 목욕탕/사우나 폐업 수 데이터 분석 & 시각화 With Python (0) 2021.08.22 코로나19 예방접종센터 현황 확인 - 지도 시각화 With Python, Pydeck (1) 2021.06.09 외국인 입국 통계 데이터 분석 With Python (1) 2021.04.14 전국 시도별 빈집 상황 알아보자 with Python (0) 2021.04.11 2015년 ~ 2019년 대한민국 인구 10만명당 자살 통계 데이터 분석 With Python (0) 2021.04.02