def make_choropleth(self): gu_info = load_gu_info() busan_geojson = load_busan_geojson() # 구청자료에 있는 확진자 데이터 가지고 오기 for i in range(len(gu_info)): if gu_info['count'][i] == 0: gu_info['count'][i] = 0 # busan_geojson와 gu_info 의 구 이름 맞춰주기 for i in range(len(gu_info)): gu_info['Name'][i] = gu_info['Name'][i][:-1] busan_map = initailize_Map() # 음영생성 folium.Choropleth(geo_data=busan_geojson, name='구별 확진자 수(음영)', data=gu_info, columns=['Name', 'count'], key_on='feature.properties.name', fill_color='Reds', fill_opacity=0.4, line_opacity=1, line_weight=2, nan_fill_opacity=0, legend_name='구별 확진자 수').add_to(busan_map) return busan_map
def make_MarkerCluster_layer(self): gu_info = load_gu_info() # MarkerCluster로와 구 layer 생성 marker_cluster = MarkerCluster(name='구별 확진자 수', overlay=True, control=True).add_to(busan_map) # 구청별 MarkerCluster 생성 for Gu_name in gu_info['Name']: gu_count = gu_info[gu_info['Name'] == Gu_name]['count'] for i in range(int(gu_count)): if i <= int(gu_count): folium.CircleMarker(location=[ float( gu_info[gu_info['Name'] == Gu_name]['Longitude']), float(gu_info[gu_info['Name'] == Gu_name]['Latitude']) ], radius=0.5, color='green').add_to(marker_cluster)
import datetime from stations import stations, bfs from functions import get_arrows, get_bearing from functions import load_subway, load_busan_geojson, load_patient, load_gu_info # from tabulate import tabulate import prettytable # sub = load_subway() # sub.rename(columns={'위도':'latitude', '경도':'longitude'}, inplace=True) # sub = sub[['역명','역주소','latitude','longitude','호선']] # sub.to_csv('Busan_subway1.csv') #No,Age,Sex,Gu,SMonth,SDate,Sday,FMonth,FDate,Fday,STime,FTime,Place,비고, # S_sub,D_sub,Address,Routing,longitude,latitude, # Unnamed: 20,Unnamed: 21,Unnamed: 22,Unnamed: 23,Unnamed: 24,Unnamed: 25 Gucheong_info = load_gu_info() Gucheong_info.rename(columns={ 'Latitude': 'longitude', 'Longitude': 'latitude' }, inplace=True) # Gucheong_info.drop(['Unnamed: 20','Unnamed: 21','Unnamed: 22','Unnamed: 23','Unnamed: 24','Unnamed: 25'], \ # axis=1, inplace=True) Gucheong_info = Gucheong_info[[ 'Name', 'Address', 'latitude', 'longitude', 'count' ]] # print(Gucheong_info.info()) # print(Gucheong_info['latitude'].sample(10)) Gucheong_info.to_csv('Gucheong_info.csv')