import pandas as pd
import folium
data = pd.read_csv("106年火災事件資料.csv")
data_modified = data[(data["縣市"]!="高雄港") & (data["縣市"]!="臺中港")]
df = pd.DataFrame()
df["區域"] = pd.Series(data_modified["鄉_鎮_市_區"].value_counts().index.values)
df["數量"] = pd.Series(data_modified["鄉_鎮_市_區"].value_counts().values)
df
Taiwan_map = folium.Map(location=[23.58,121], zoom_start=7)
folium.Choropleth(
geo_data="鄉鎮市區行政區域界線.json",
name='choropleth',
data = df,
fill_color='YlGnBu',
columns=["區域","數量"],
key_on='feature.properties.T_Name',
).add_to(Taiwan_map)
#display(Taiwan_map)
Taiwan_map.save('Folium_火災統計.html')