算是學習記錄,平常用到的Excel表格的操作
import xlrd
import matplotlib.pyplot as plt
if __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()