prahul11 2023-10-26 14:26:41 +05:30
parent 075130d7ce
commit 2f7faa2f86
1 changed files with 4 additions and 2 deletions

View File

@ -56,10 +56,12 @@ def do_the_difference(today_file, last_file, column_for_diff, fresh_output, expi
expired_df = pd.merge(last_file_df, today_df, on=column_for_diff, how='left', indicator=True, suffixes=('', '_ignored')).query('_merge == "left_only"').drop(['_merge'], axis=1) expired_df = pd.merge(last_file_df, today_df, on=column_for_diff, how='left', indicator=True, suffixes=('', '_ignored')).query('_merge == "left_only"').drop(['_merge'], axis=1)
child_df_copy = expired_df.copy() child_df_copy = expired_df.copy()
if gi =="g": if gi =="g":
child_df_copy['Job Key'] = 'g_' + child_df_copy['Job Key'] child_df_copy['Job Key'] = 'g_' + child_df_copy['Job Key'].astype(str)
expired_df['Job key'] = expired_df['Job key'].astype(str)
expired_df = pd.concat([expired_df, child_df_copy], ignore_index=True) expired_df = pd.concat([expired_df, child_df_copy], ignore_index=True)
else: # jobId else: # jobId
child_df_copy['jobId'] = 'i_' + child_df_copy['jobId'] child_df_copy['jobId'] = 'i_' + child_df_copy['jobId'].astype(str)
expired_df['jobId'] = expired_df['jobId'].astype(str)
expired_df = pd.concat([expired_df, child_df_copy], ignore_index=True) expired_df = pd.concat([expired_df, child_df_copy], ignore_index=True)
expired_df.to_csv(expired_output, index=False) expired_df.to_csv(expired_output, index=False)