首页 > 代码库 > python pandas读写excel

python pandas读写excel

from openpyxl import load_workbook import pandas as pd

data = http://www.mamicode.com/pd.read_excel(‘test1.xlsx‘, sheetname=0) # col_data = list(data.ix[:, 5]) # 获取除表头外开始的第五列数据 row_data = list(data.ix[5,:]) # 获取除表头外开始的第五行数据 writer = pd.ExcelWriter( ‘test2.xlsx‘, engine=‘openpyxl‘) book = load_workbook(‘test2.xlsx‘) writer.book = book result = pd.DataFrame(row_data) result.to_excel(writer,sheet_name=0, index=False) writer.save()

python pandas读写excel