python Excel的操作

来源:互联网 发布:淘宝团队规模 编辑:程序博客网 时间:2024/05/21 18:34

算是学习记录,平常用到的Excel表格的操作

import xlrdimport matplotlib.pyplot as pltif __name__ == '__main__':    target = xlrd.open_workbook('first.xls','r')  #文件名要写完整路径,这里的文件直接放在了和.py同一个目录了    sh = target.sheet_by_index(0) #取第一张表      col0Values = sh.col_values(0) # 取第一列    col1Values = sh.col_values(1)  # 取第二列    plt.plot(col0Values,col1Values)    plt.show()








原创粉丝点击