python_execel表格数据转化为列表list from pyecharts import options as opts from pyecharts . charts import Geo from pyecharts . globals import ChartType , SymbolType # 导入数据 # 湖北地区新增数据 data_num = pandas . read_
python_execel表格数据转化为列表list
from pyecharts import options as optsfrom pyecharts.charts import Geo
from pyecharts.globals import ChartType, SymbolType
# 导入数据
# 湖北地区新增数据
data_num = pandas.read_excel('C:/data/zhiyuan.xlsx',sheet_name='湖北确诊人数')
print(type(data_num))
<class 'pandas.core.frame.DataFrame'>
# 将数据转换为二元的列表
data_num_list = list(zip(data_num['area'],data_num['num']))
print(type(data_num_list))
<class 'list'>
print(data_num_list)
[('荆门 ', 663), ('十堰 ', 467), ('仙桃 ', 379), ('恩施 ', 171), ('随州 ', 984), ('荆州 ', 997), ('黄石 ', 760), ('神农架', 10), ('襄阳 ', 988), ('天门 ', 197), ('宜昌 ', 711), ('鄂州 ', 639), ('潜江 ', 82), ('孝感 ', 2436), ('黄冈 ', 2141), ('咸宁 ', 493)]