我使用dataframe合并3次以获得我想要的结果
def write_dips(writer):
df_dips = pd.read_excel(file_path, sheet_name='DipsSummary')
df_sales = pd.read_excel(file_path, sheet_name='SaleSummary')
df_delivery = pd.read_excel(file_path, sheet_name='DeliverySummary')
df_mapping = pd.read_csv(mappingfilepath, delimiter=',', skiprows=[1])
df_dips = df_dips.merge(df_mapping, left_on='Site', right_on='SHIP TO NAME',how='left')
df_dips = df_dips.merge(df_sales, left_on ='IDASS ID', right_on='IdassId',how='left')
df_dips = df_dips.merge(df_delivery, left_on='SHIP-TO PARTY', right_on='Ship-To Party', how='left')
当我尝试执行第三合并选项时,出现以下错误;
以退出代码137(被信号9:SIGKILL中断)结束的过程
我该如何克服这个问题?
答案 0 :(得分:1)
我在每次合并时都使用fillna(0)
进行了克服。
def write_dips(writer):
df_dips = pd.read_excel(file_path, sheet_name='DipsSummary')
df_sales = pd.read_excel(file_path, sheet_name='SaleSummary')
df_delivery = pd.read_excel(file_path, sheet_name='DeliverySummary')
df_mapping = pd.read_csv(mappingfilepath, delimiter=',', skiprows=[1])
df_dips = df_dips.merge(df_mapping, left_on='Site', right_on='SHIP TO NAME',how='left').fillna(0)
df_dips = df_dips.merge(df_sales, left_on ='IDASS ID', right_on='IdassId',how='left').fillna(0)
df_dips = df_dips.merge(df_delivery, left_on='SHIP-TO PARTY', right_on='Ship-To Party', how='left').fillna(0)