Question: please define the function compare_changes() that meets the requirements in the photos Motivation (don't dwell on this): Our next task is to identify records which


Motivation (don't dwell on this): Our next task is to identify records which have changed and which records are unchanged. These are a subset of records having keys in both the business data and the active journal. We need to partition both the business data and journal data into two parts based on whether the data has changed. Requirements: Deline compare_changes (compare_new_df, compare_old_df, audit_cols). The inputs are as foliows: - compare_new_de - a DataFrame - coapare_old_df - another DataFrame with the same columns/shape/indexing as compare_new_df - audit_cols - a list of column names which should not be used for comparison. You can assume that the rows compare_new_dt and compare_old_df are sorted and indexed such that they can be compared directly. 0 L_f folf - Idemify the columnt in coepare_new_de which ahe not in audit__cola. Let's call this cole. - Compare the values in conpare_new_df [ colt } with the values in compare_old_df [ cola ]. - Return these 3 now DataFramesz - unchanged - All of the rows in compare_new_de where ali valuas are the same in the comparition. - old changed - All of the rows in ecepare_eld_de where there are any differences in the comparison. - nes__ehanged - All of the rowe in eompare_new_df where there are any differences in the comparison. The demo included in the solution cell below should display the following output: Motivation (don't dwell on this): Our next task is to identify records which have changed and which records are unchanged. These are a subset of records having keys in both the business data and the active journal. We need to partition both the business data and journal data into two parts based on whether the data has changed. Requirements: Deline compare_changes (compare_new_df, compare_old_df, audit_cols). The inputs are as foliows: - compare_new_de - a DataFrame - coapare_old_df - another DataFrame with the same columns/shape/indexing as compare_new_df - audit_cols - a list of column names which should not be used for comparison. You can assume that the rows compare_new_dt and compare_old_df are sorted and indexed such that they can be compared directly. 0 L_f folf - Idemify the columnt in coepare_new_de which ahe not in audit__cola. Let's call this cole. - Compare the values in conpare_new_df [ colt } with the values in compare_old_df [ cola ]. - Return these 3 now DataFramesz - unchanged - All of the rows in compare_new_de where ali valuas are the same in the comparition. - old changed - All of the rows in ecepare_eld_de where there are any differences in the comparison. - nes__ehanged - All of the rowe in eompare_new_df where there are any differences in the comparison. The demo included in the solution cell below should display the following output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
