网站建设系统规划方案,后台管理页面模板,wordpress 动作钩子,纯手工建网站2023年最新5A景区有多少个#xff1f;Python可视化告诉你
五一小长假来了#xff0c;很多人想抓住小长假的机会去旅游。
5A景区是大多数人的首选#xff0c;全国最新有多少个5A景区呢#xff0c;应该还有很多人不知道。本文用Python进行可视化#xff0c;告诉你答案。
…2023年最新5A景区有多少个Python可视化告诉你
五一小长假来了很多人想抓住小长假的机会去旅游。
5A景区是大多数人的首选全国最新有多少个5A景区呢应该还有很多人不知道。本文用Python进行可视化告诉你答案。
各年5A景区数量 用瀑布图的方式展示各年的5A景区数量截止2023年5月全国共有319个5A景区。实现代码如下。
瀑布图介绍参考循序渐进学会用pyecharts绘制瀑布图。
from pyecharts.charts import Geo, Map, Bar
from pyecharts import options as opts
from pyecharts.globals import GeoType, ChartType
import pandas as pd
import numpy as npdef scenery_num_by_year():5A景区数按年增长情况df pd.read_excel(scenery_info.xlsx)s df[年份].value_counts().sort_index()bar Bar(init_optsopts.InitOpts(width800px, height500px))bar.add_xaxis(s.index.to_list()).add_yaxis(, y_axis[0, 66, 76, 119, 145, 171, 183, 212, 227, 249, 258, 280, 302, 306], category_gap1,stack5A景区总数, itemstyle_optsopts.ItemStyleOpts(colorrgb(240,240,240))).add_yaxis(新增数量, y_axiss.to_list(), stack5A景区总数, category_gap1).set_global_opts(title_optsopts.TitleOpts(title各年5A景区数量变化, pos_left300, pos_top15,title_textstyle_optsopts.TextStyleOpts(color#1A56C8, font_size16)), xaxis_optsopts.AxisOpts(split_number6, axislabel_optsopts.LabelOpts(font_size12, color#1A56C8)), yaxis_optsopts.AxisOpts(axislabel_optsopts.LabelOpts(font_size12, color#1A56C8, margin12, font_weightbolder),), legend_optsopts.LegendOpts(is_showFalse)).set_series_opts(yaxis_optsopts.AxisOpts(type_value),).render(5a_scenery_num_by_year.html)各省5A景区数量排名 江苏省共有25个5A景区一骑绝尘。实现代码如下。
def scenery_num_by_province():各省5A景区数排名df pd.read_excel(scenery_info.xlsx)s df[所属地区].value_counts(ascendingTrue)bar Bar(init_optsopts.InitOpts(width800px, height1000px, bg_color#C8C8C8))bar.add_xaxis(s.index.to_list()).add_yaxis(, s.to_list(), category_gap5).reversal_axis().set_global_opts(title_optsopts.TitleOpts(title各省5A景区数排名, pos_left280, pos_top15,title_textstyle_optsopts.TextStyleOpts(color#1A56C8, font_size16)), xaxis_optsopts.AxisOpts(max_30, split_number6, is_showFalse,), yaxis_optsopts.AxisOpts(axislabel_optsopts.LabelOpts(font_size12, color#1A56C8, margin12, font_weightbolder),splitline_optsopts.SplitLineOpts(is_showFalse)), legend_optsopts.LegendOpts(is_showFalse)).set_series_opts(label_optsopts.LabelOpts(font_size14, font_weightbolder, font_familyitalic, color#7030A0,positionright, distance10, vertical_alignmiddle)).set_colors(#FF9366).render(5a_scenery_num_by_province.html)def province_name_paser(name):province_name [北京市, 天津市, 河北省, 山西省, 内蒙古自治区, 辽宁省, 吉林省,黑龙江省, 上海市, 江苏省, 浙江省, 安徽省, 福建省, 江西省, 山东省,河南省, 湖北省, 湖南省, 广东省, 广西壮族自治区, 海南省, 重庆市,四川省, 贵州省, 云南省, 西藏自治区, 陕西省, 甘肃省, 青海省,宁夏回族自治区, 新疆维吾尔自治区, 台湾省, 香港特别行政区, 澳门特别行政区]for p in province_name:if name in p:return p各省5A景区分布情况 上图可视化了各省的5A景区分布情况沿海地区、长江黄河流域、平原区域5A景区更多。实现代码如下。
def scenery_by_province():各省5A景区数量分布map Map(init_optsopts.InitOpts(bg_colorblack, width1300px, height700px))df pd.read_excel(scenery_info.xlsx)df[所属地区] df[所属地区].apply(lambda x: province_name_paser(x))s df[所属地区].value_counts()data_pair [[province, int(s[province])] for province in s.index]# print(data_pair)map.add(, data_pairdata_pair, maptypechina, is_map_symbol_showFalse).set_global_opts(title_optsopts.TitleOpts(title各省5A景区数量分布, pos_left550, pos_top50,title_textstyle_optsopts.TextStyleOpts(colorwhite, font_size16)), visualmap_optsopts.VisualMapOpts(max_27, is_piecewiseTrue, pos_left350, pos_bottom100, split_number9,textstyle_optsopts.TextStyleOpts(colorwhite, font_size10)), legend_optsopts.LegendOpts(is_showFalse)).set_series_opts(label_optsopts.LabelOpts(font_size8, font_weightbolder, font_familymonospace)).render(5a_scenery_by_province.html)各省5A景区位置标注 把所有5A景区的位置标注出来可以更方便查看景区的位置和分布情况。实现代码如下。
def scenery_location_mark():5A景区位置标注geo Geo(init_optsopts.InitOpts(bg_colorblack, width1600px, height900px))df pd.read_excel(scenery_info.xlsx)for row_index, row_data in df.iterrows():geo.add_coordinate(row_data[景区名称], row_data[经度], row_data[纬度])data_pair [(name, 1) for name in df[景区名称]]# print(data_pair)geo.add_schema(maptypechina, is_roamTrue,itemstyle_optsopts.ItemStyleOpts(color#323c48, border_color#408080)).add(, data_pairdata_pair, type_GeoType.SCATTER, symbolpin, symbol_size16, color#CC3300).set_series_opts(label_optsopts.LabelOpts(is_showFalse)).set_global_opts(title_optsopts.TitleOpts(title全国5A景区位置标注图, pos_left720, pos_top50,title_textstyle_optsopts.TextStyleOpts(color#1A56C8, font_size18)), legend_optsopts.LegendOpts(is_showFalse)).render(5a_scenery_location_mark.html)2023年最新5A景区速查表 如果你需要excel表格的数据和完整的可视化代码请WX私信联系我获取。 数据来源 [1] 5A景区信息来源于中国文旅部官网。 [2] 5A景区的经纬度来源于百度地图。 相关阅读
循序渐进学会用pyecharts绘制瀑布图
欢迎 点赞 收藏⭐ 评论 关注❤ 如有错误敬请指正
☟ 学Python点击下方名片关注我。☟