Skip to content

Commit

Permalink
fixups for join
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzoic committed Aug 17, 2023
1 parent 8ef532e commit 7d7a478
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions countess/plugins/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ def process_dataframes(self, dataframe1: pd.DataFrame, dataframe2: pd.DataFrame,
drop_index = dataframe2.index.name is None and dataframe2.index.names[0] is None
dataframe2 = dataframe2.reset_index(drop=drop_index)

dataframe = dataframe1.merge(dataframe2, **self.join_params)
try:
dataframe = dataframe1.merge(dataframe2, **self.join_params)
except ValueError as exc:
logger.exception(exc)
return pd.DataFrame()

if self.parameters["inputs"][0]["drop"].value and join1 in dataframe.columns:
dataframe.drop(columns=join1, inplace=True)
Expand All @@ -102,6 +106,7 @@ def finalize(self, logger: Logger) -> Iterable:
assert self.input_columns_1 is not None
assert self.input_columns_2 is not None
ip1, ip2 = self.parameters["inputs"]

ip1.set_column_choices(self.input_columns_1.keys())
ip2.set_column_choices(self.input_columns_2.keys())
return []
yield from super().finalize(logger)

0 comments on commit 7d7a478

Please sign in to comment.