if data_ods.shape[0]==data_dwh.shape[0]: pass else: data_ods_primarykey=pd.dataframe(data_ods[primarykey]) data_dwh_primarykey=pd.dataframe(data_dwh[primarykey]) df_union = pd.concat([data_ods_primarykey,data_dwh_primarykey]) # 实现1 df_diff_ods = df_union.append(data_ods_primarykey).drop_duplicates(subset=df_union.columns.to_list(), keep=false) df_diff_dwh = df_union.append(data_dwh_primarykey).drop_duplicates(subset=df_union.columns.to_list(), keep=false) #dwh多的合同 df_diff_ods #dwh少的合同 df_diff_dwh df_diff_dwh_data=[] df_diff_ods_data=[] for i in df_diff_ods.head(10).values.tolist(): for n in i: df_diff_ods_data.append(n) for i in df_diff_dwh.head(10).values.tolist(): df_diff_dwh_data.append(n) while true: if len(df_diff_dwh_data)>len(df_diff_ods_data): df_diff_ods_data.append("-") elif len(df_diff_dwh_data)