# Task2_Pyecharts **Repository Path**: NFUNM026/Task2_Pyecharts ## Basic Information - **Project Name**: Task2_Pyecharts - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-10-08 - **Last Updated**: 2024-10-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
import pandas as pd
df = pd.read_csv("population.csv",encoding="gbk")
df
print(list(df.地区))
print(list(df.year_end_resident_population))
人口 = zip(list(df.地区),list(df.year_end_resident_population))
print(人口)
人口=list(zip(list(df.地区),list(df.year_end_resident_population.fillna(0))))
print(人口)
df.year_end_resident_population.describe()
from pyecharts import options as opts
from pyecharts.charts import Geo
from pyecharts.globals import ChartType, SymbolType
def geo_总人口() -> Geo:
c = (
Geo()
.add_schema(maptype="china")
.add("年末常住人口(万人)",人口)
.set_series_opts(label_opts=opts.LabelOpts(is_show=False))
.set_global_opts(
visualmap_opts=opts.VisualMapOpts(min_= 337.000000, max_=11169.000000),
title_opts=opts.TitleOpts(title="2017年中国分省常住人口数据"),
)
)
return c
地理图 = geo_总人口()
地理图.render_notebook()