使用pandas读取原数据,写成数据框即可,参考如下代码:
import pandas as pd
ind=['one','two','three','four','five','six','seven']
df=pd.DataFrame({'年份':[2017,2015,2013,2016,2009,2011,2005],
'省份': ['北京','上海','天津','重庆','江苏','浙江','广东'],
'总人数':[2115,2415,1007,5000,6992,36002,82396],
'高考人数':[6.06,5.10,6.21,24.89,36.04,88.31,62.38]}
,index=ind)
print(df)
输出:
年份 省份 总人数 高考人数
one 2017 北京 2115 6.06
two 2015 上海 2415 5.10
three 2013 天津 1007 6.21
four 2016 重庆 5000 24.89
five 2009 江苏 6992 36.04
six 2011 浙江 36002 88.31
seven 2005 广东 82396 62.38
如有帮助,请点采纳