python pandas读写excel

  1. 读取excel
import pandas as pd
df = pd.read_excel('data.xlsx')
  1. 写入excel
import pandas as pd
df = pd.read_excel('data.xlsx')
writer = pd.ExcelWriter('out.xlsx')
df2 = pd.DataFrame(data = df['column0']) #取出data的column[0]存入out.xlsx中
df2.to_excel(writer, 'sheet1', index = False) #只保存column[0]而没有index
writer.save()

你可能感兴趣的:(Python)