Skip to content

Commit

Permalink
Types check in delta calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
vg12345 committed Sep 30, 2024
1 parent e6fd942 commit e3c6f98
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ def _get_delta(self, first_df: pd.DataFrame, second_df:pd.DataFrame):
merged_df = pd.merge(second_df, first_df, on=self.BASED_COLUMNS, how='inner', suffixes=('', '_x'))
delta_dataframe = pd.DataFrame()
for _,col in enumerate(second_df.columns):
if col not in self.KEY:
col_x = col + "_x"
col_x = col + "_x"
if col not in self.KEY\
and not merged_df[col].apply(lambda x: isinstance(x, str)).any()\
and not merged_df[col_x].apply(lambda x: isinstance(x, str)).any():
try:
delta_dataframe[col] = merged_df[col] - merged_df[col_x]
except TypeError:
Expand Down

0 comments on commit e3c6f98

Please sign in to comment.