import pandas as pd
import openpyxl
from pandas import DataFrame
Expore= pd.read_excel('sales_FINAL.xlsx',sheet_name='Sheet1')
Expore["SO+LINE"]= Expore['Sales Doc'].map(str)+Expore['Sales Doc Item'].map(str)
column1= Expore['SO+LINE']
column2= Expore['Created By']
Expore=pd.DataFrame({"SO+LINE":column1,
"Created By":column2,
})
Expore.drop_duplicates(subset='SO+LINE',inplace=True,keep='first')
Expore.to_excel('open_new.xlsx',sheet_name='GTS Blocked SO',index=None,header=True)
数据是如下这样。Sales Doc为文本格式或者数字。然后run下来就报错
Sales Doc Sales Doc Item
3000561929 10
3000564356 10
3000568582 60
3000570574 10
3000571113 10
3000575647 60
3000576468 10
3000576560 10
3000576715 10
3000576722 10
3000577644 20
3000578679 10