Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion diffly/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,9 @@ def summary(
Args:
show_perfect_column_matches: Whether to include column matches in the
summary even if the column match rate is 100%. Setting this to ``False``
is useful when comparing very wide data frames.
is useful when comparing very wide data frames. This also applies to the
"Data Inspection" section: columns for which all data metrics are
unchanged between the two sides are omitted.
top_k_column_changes: The maximum number of column values changes to
display for columns with a match rate below 100% in the summary. When
enabling this feature, make sure that no sensitive data is leaked.
Expand Down
20 changes: 13 additions & 7 deletions diffly/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,9 @@ def _validate_primary_key_hidden_columns() -> None:
show_sample_primary_key_per_change,
change_metrics_by_column,
)
data_inspection = _compute_data_inspection(comp, data_metrics, hidden_columns)
data_inspection = _compute_data_inspection(
comp, data_metrics, hidden_columns, show_perfect_column_matches
)
sample_rows_left_only, sample_rows_right_only = _compute_sample_rows(
comp, sample_k_rows_only
)
Expand Down Expand Up @@ -1138,6 +1140,7 @@ def _compute_data_inspection(
comp: DataFrameComparison,
metrics: Mapping[str, DataMetric],
hidden_columns: list[str],
show_perfect_column_matches: bool,
) -> list[SummaryDataInspectionColumn] | None:
# NOTE: Data metrics describe each side individually and do not need a join, but we
# still require the columns to be present on both sides so left/right values are
Expand All @@ -1150,12 +1153,15 @@ def _compute_data_inspection(
if not any(metric_to_columns.values()):
return None
data_metrics_by_column = _compute_data_metrics(comp, metrics, metric_to_columns)
return [
SummaryDataInspectionColumn(
name=col_name, data_metrics=data_metrics_by_column[col_name]
)
for col_name in sorted(data_metrics_by_column)
]
columns = []
for col_name in sorted(data_metrics_by_column):
results = data_metrics_by_column[col_name]
if not show_perfect_column_matches and all(
r.left == r.right for r in results.values()
):
continue
Comment on lines +1156 to +1162

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

irrelevant

columns.append(SummaryDataInspectionColumn(name=col_name, data_metrics=results))
return columns


def _compute_sample_rows(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Column ┃ Null% ┃ Distinct ┃ Max ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━┩
│ id │ 0.0% -> 0.0% (+0.0) │ 5 -> 5 (+0) │ │
│ price │ 20.0% -> 0.0% (-20.0) │ 5 -> 5 (+0) │ │
│ status │ 0.0% -> 40.0% (+40.0) │ 5 -> 4 (-1) │ e -> x │
└────────┴───────────────────────┴─────────────┴────────┘
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Column ┃ Null% ┃ Distinct ┃ Max ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━┩
│ id │ 0.0% -> 0.0% (+0.0) │ 5 -> 5 (+0) │ │
│ price │ 20.0% -> 0.0% (-20.0) │ 5 -> 5 (+0) │ │
│ status │ 0.0% -> 40.0% (+40.0) │ 5 -> 4 (-1) │ e -> x │
└────────┴───────────────────────┴─────────────┴────────┘
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Column ┃ Null% ┃ Distinct ┃ Max ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━┩
│ id │ 0.0% -> 0.0% (+0.0) │ 5 -> 5 (+0) │ │
│ price │ 20.0% -> 0.0% (-20.0) │ 5 -> 5 (+0) │ │
│ status │ 0.0% -> 40.0% (+40.0) │ 5 -> 4 (-1) │ e -> x │
└────────┴───────────────────────┴─────────────┴────────┘
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Column ┃ Null% ┃ Distinct ┃ Max ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━┩
│ id │ 0.0% -> 0.0% (+0.0) │ 5 -> 5 (+0) │ │
│ price │ 20.0% -> 0.0% (-20.0) │ 5 -> 5 (+0) │ │
│ status │ 0.0% -> 40.0% (+40.0) │ 5 -> 4 (-1) │ e -> x │
└────────┴───────────────────────┴─────────────┴────────┘
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Column ┃ Null% ┃ Distinct ┃ Max ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━┩
│ id │ 0.0% -> 0.0% (+0.0) │ 5 -> 5 (+0) │ │
│ price │ 20.0% -> 0.0% (-20.0) │ 5 -> 5 (+0) │ │
│ status │ 0.0% -> 40.0% (+40.0) │ 5 -> 4 (-1) │ e -> x │
└────────┴───────────────────────┴─────────────┴────────┘
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Column ┃ Null% ┃ Distinct ┃ Max ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━┩
│ id │ 0.0% -> 0.0% (+0.0) │ 5 -> 5 (+0) │ │
│ price │ 20.0% -> 0.0% (-20.0) │ 5 -> 5 (+0) │ │
│ status │ 0.0% -> 40.0% (+40.0) │ 5 -> 4 (-1) │ e -> x │
└────────┴───────────────────────┴─────────────┴────────┘
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Column ┃ Null% ┃ Distinct ┃ Max ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━┩
│ id │ 0.0% -> 0.0% (+0.0) │ 5 -> 5 (+0) │ │
│ price │ 20.0% -> 0.0% (-20.0) │ 5 -> 5 (+0) │ │
│ status │ 0.0% -> 40.0% (+40.0) │ 5 -> 4 (-1) │ e -> x │
└────────┴───────────────────────┴─────────────┴────────┘
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Column ┃ Null% ┃ Distinct ┃ Max ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━┩
│ id │ 0.0% -> 0.0% (+0.0) │ 5 -> 5 (+0) │ │
│ price │ 20.0% -> 0.0% (-20.0) │ 5 -> 5 (+0) │ │
│ status │ 0.0% -> 40.0% (+40.0) │ 5 -> 4 (-1) │ e -> x │
└────────┴───────────────────────┴─────────────┴────────┘

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,4 @@
│ │ (+0.0) │ (+0.6) │ (+0.0) │ (+0.0) │ (+0.0) │
│ qty │ 0.0% -> 0.0% │ 3.0 -> 3.2 │ 3.0 -> 3.0 │ 1 -> 1 (+0) │ 5 -> 5 (+0) │
│ │ (+0.0) │ (+0.2) │ (+0.0) │ │ │
│ status │ 0.0% -> 0.0% │ │ │ │ │
│ │ (+0.0) │ │ │ │ │
└────────┴──────────────┴──────────────┴──────────────┴──────────────┴──────────────┘
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,4 @@
│ │ (+0.0) │ (+0.6) │ (+0.0) │ (+0.0) │ (+0.0) │
│ qty │ 0.0% -> 0.0% │ 3.0 -> 3.2 │ 3.0 -> 3.0 │ 1 -> 1 (+0) │ 5 -> 5 (+0) │
│ │ (+0.0) │ (+0.2) │ (+0.0) │ │ │
│ status │ 0.0% -> 0.0% │ │ │ │ │
│ │ (+0.0) │ │ │ │ │
└────────┴──────────────┴──────────────┴──────────────┴──────────────┴──────────────┘
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,4 @@
│ │ (+0.0) │ (+0.6) │ (+0.0) │ (+0.0) │ (+0.0) │
│ qty │ 0.0% -> 0.0% │ 3.0 -> 3.2 │ 3.0 -> 3.0 │ 1 -> 1 (+0) │ 5 -> 5 (+0) │
│ │ (+0.0) │ (+0.2) │ (+0.0) │ │ │
│ status │ 0.0% -> 0.0% │ │ │ │ │
│ │ (+0.0) │ │ │ │ │
└────────┴──────────────┴──────────────┴──────────────┴──────────────┴──────────────┘
Loading