import xlrd workbook = xlrd.open_workbook('example.xlsx') worksheet = workbook.sheet_by_index(0) data = pd.DataFrame() for row in range(worksheet.nrows): values = {} for col in range(worksheet.ncols): values[str(worksheet.cell(row, col))] = worksheet.cell(row, col).value data = data.append(values, ignore_index=True) import xlrd import pandas as pd data = pd.DataFrame({'A': [1, 2, 3], 'B': ['a', 'b', 'c']}) data.to_excel('example.xlsx', index=False)


上一篇:
下一篇:
切换中文