import xlrd
# 读取Excel文件 wb = xlrd.open_workbook(r"E:\PythonStudyAll\TestD20231130\1111.xlsx") data=wb.sheet_by_name('Sheet1') # 定义要读取的列和行范围 column_index_x = 0 # 第一列的索引为0 column_index_y = 1 # 第一列的索引为0 start_row = 2 # 起始行索引,需要减去1,因为索引是从0开始 end_row = 10 # 结束行索引 # 读取指定范围的行数据 time=data.col_values(column_index_x, start_row, end_row) mag=data.col_values(column_index_y, start_row, end_row) print(time) print(mag) plt.plot(time, mag) plt.show()
标签:index,读取,索引,Python,Excel,column,xlrd,row From: https://www.cnblogs.com/Nigel-ff/p/17884120.html