fileTest
#!/usr/bin/env python # -*- coding: utf-8 -*- # 读取excel数据 # 取第二行以下的数据,然后取每行前13列的数据 import xlrd data = xlrd.open_workbook(R'G:\apple.xlsx') # 打开xls文件 table = data.sheets()[0] # 打开第一张表 nrows = table.nrows # 获取表的行数 for i in range(nrows): # 循环逐行打印 if i == 0: # 跳过第一行 continue print (table.row_values(i)[:13] )# 取前十三列
chartTest
#!/usr/bin/env python # -*- coding: utf-8 -*- from pylab import * # make a square figure and axes figure(1, figsize=(6, 6)) ax = axes([0.1, 0.1, 0.8, 0.8]) labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' fracs = [15, 30, 45, 10] explode = (0, 0.05, 0, 0) pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True) title('Raining Hogs and Dogs', bbox={'facecolor': '0.8', 'pad': 5}) savefig('D:\pie.png') show()