同个人网站 https://www.serendipper-x.cn/,欢迎访问 !
# 导入相关包
from pyecharts import options as opts
from pyecharts.charts import Map, Geo, Lindata = pd.read_csv(r'C:\Users\1979\Desktop\处理后的数据\谷物产量(公吨)(2000-2017).csv')value = data.iloc[:,18]
attr = data.iloc[:,0]
# 显示世界地图
def map_world() -> Map:c = (Map(init_opts=opts.InitOpts(# 设置主题theme='wonderland')).add("", [list(z) for z in zip(attr, value)], "world",is_map_symbol_show=False).set_series_opts(label_opts=opts.LabelOpts(is_show=False),itemstyle_opts={'normal': {'opacity': 0.6}}).set_global_opts(title_opts=opts.TitleOpts(title="Distribution map of global grain production",pos_right="center",pos_top="1%"),visualmap_opts=opts.VisualMapOpts(max_=710000000,min_=10),))return ccountry_ = map_world()
country_.render_notebook()