Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # creates an empty list to append to
- differences = []
- # for all the IDs in the dataframe that should not change check if this record is the same in the database
- # must use reset_index() so the equals() will work as I expect it to
- # if it is not the same, append to a list which has the Aspn ID that is failing, along with the columns that changed
- for unique_id in new_df['ID'].tolist():
- if new_df.loc[new_df['ID'] == unique_id].reset_index(drop=True).equals(sql_df.loc[sql_df['ID'] == unique_id].reset_index(drop=True)) is False:
- bad_columns = []
- for column in new_df.columns.tolist():
- if new_df.loc[new_df['ID'] == unique_id][column].reset_index(drop=True).equals(sql_df.loc[sql_df['ID'] == unique_id][column].reset_index(drop=True)) is False:
- bad_columns.append(column)
- differences.append([unique_id, bad_columns])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement