diff --git a/sdmetrics/reports/multi_table/_properties/relationship_validity.py b/sdmetrics/reports/multi_table/_properties/relationship_validity.py index c85a957b..95145271 100644 --- a/sdmetrics/reports/multi_table/_properties/relationship_validity.py +++ b/sdmetrics/reports/multi_table/_properties/relationship_validity.py @@ -43,7 +43,7 @@ def _generate_details(self, real_data, synthetic_data, metadata, progress_bar=No for relation in metadata.get('relationships', []): real_columns = self._extract_tuple(real_data, relation) synthetic_columns = self._extract_tuple(synthetic_data, relation) - for idx, metric in enumerate(metrics): + for metric in metrics: try: relation_score = metric.compute( real_columns, @@ -53,9 +53,6 @@ def _generate_details(self, real_data, synthetic_data, metadata, progress_bar=No except Exception as e: relation_score = np.nan error_message = f'{type(e).__name__}: {e}' - finally: - if progress_bar is not None and idx % 2 == 0: - progress_bar.update() child_tables.append(relation['child_table_name']) parent_tables.append(relation['parent_table_name']) @@ -65,6 +62,9 @@ def _generate_details(self, real_data, synthetic_data, metadata, progress_bar=No scores.append(relation_score) error_messages.append(error_message) + if progress_bar: + progress_bar.update() + self.details = pd.DataFrame({ 'Parent Table': parent_tables, 'Child Table': child_tables,