China's gdp chart from 1949 to 2019_Python visual map: GDP of China's provinces in 2019 (pyecharts geographic chart)...

e72ba780e3977ecea441618e4656ceb8.png

Hello everyone!

Today, I will share how to use Python tools to help us make a visual map showing the GDP of each province in China in 2019.

4934289c766b5f503a0aa39ea223af75.png

The data table structure in the case is as follows:

be27a06f870f372efe9955ab2f571e4b.png

Code and demo:

import numpy as np
import pandas as pd
from pyecharts.globals import ThemeType
from pyecharts import options as opts
from pyecharts.charts import Map

df_map = pd.read_excel("D:01会Excel的隔壁老王Excel报表20200506-Python地图可视化:2019年中国各省GDP情况Python地图可视化:2019年中国各省GDP情况.xlsx")

df_map

368f2e2a99b22d03cd26252affcd1ad4.png
c = (
    Map(init_opts=opts.InitOpts(width="1000px", height="600px",theme = ThemeType.DARK))
    .add("2019年中国各省GDP", df_map[["地区","2019年省GDP总量(亿)"]].values.tolist(), "china")
    .set_global_opts(
        title_opts=opts.TitleOpts(title="2019年中国各省GDP总量(亿)(微信公众号:会Excel的隔壁老王)",pos_bottom = "90%", pos_right = "20%"),
        visualmap_opts=opts.VisualMapOpts(type_= "color",max_=110000, range_text = ['GDP总量(亿)颜色区间:', ''],is_piecewise=1,pos_top= "middle",pos_left="left",orient="vertical",split_number=10),
        #tooltip_opts = opts.TooltipOpts(formatter="{c} %")
    )
    #.render("map_visualmap_piecewise.html")
)

c.render_notebook()

4934289c766b5f503a0aa39ea223af75.png

Complete python code reference:

import numpy as np
import pandas as pd
from pyecharts.globals import ThemeType
from pyecharts import options as opts
from pyecharts.charts import Map

df_map = pd.read_excel("D:01会Excel的隔壁老王Excel报表20200506-Python地图可视化:2019年中国各省GDP情况Python地图可视化:2019年中国各省GDP情况.xlsx")

c = (
    Map(init_opts=opts.InitOpts(width="1000px", height="600px",theme = ThemeType.DARK))
    .add("2019年中国各省GDP", df_map[["地区","2019年省GDP总量(亿)"]].values.tolist(), "china")
    .set_global_opts(
        title_opts=opts.TitleOpts(title="2019年中国各省GDP总量(亿)(微信公众号:会Excel的隔壁老王)",pos_bottom = "90%", pos_right = "20%"),
        visualmap_opts=opts.VisualMapOpts(type_= "color",max_=110000, range_text = ['GDP总量(亿)颜色区间:', ''],is_piecewise=1,pos_top= "middle",pos_left="left",orient="vertical",split_number=10),
        #tooltip_opts = opts.TooltipOpts(formatter="{c} %")
    )
    #.render("map_visualmap_piecewise.html")
)

c.render_notebook()

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324210412&siteId=291194637