feat: Add data metrics for numeric columns#46
feat: Add data metrics for numeric columns#46Moritz Potthoff (MoritzPotthoffQC) wants to merge 27 commits into
Conversation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: EgeKaraismailogluQC <128645043+EgeKaraismailogluQC@users.noreply.github.com>
…_fraction.py Co-authored-by: EgeKaraismailogluQC <128645043+EgeKaraismailogluQC@users.noreply.github.com>
Co-authored-by: quant-ranger[bot] <132915763+quant-ranger[bot]@users.noreply.github.com> Co-authored-by: Marius Merkle <marius.merkle@quantco.com> Co-authored-by: Marius Merkle <122545105+MariusMerkleQC@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #46 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 14 14
Lines 1052 1070 +18
=========================================
+ Hits 1052 1070 +18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds additional data metrics (computed per-side, then rendered as old -> new (delta)) for numeric columns, and updates summary rendering + golden fixtures to accommodate the expanded metric set.
Changes:
- Added new data-metric functions (
mean_data,median_data,min_data,max_data,std_data) and expandedDEFAULT_DATA_METRICS. - Updated summary table rendering to apply consistent overflow handling to metric columns.
- Updated tests, docs, and regenerated summary fixtures to reflect the new preset metrics/labels and the updated table layout.
Reviewed changes
Copilot reviewed 86 out of 86 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| diffly/metrics/data.py | Adds numeric “data” metrics and updates the data-metric presets/utilities. |
| diffly/summary.py | Applies consistent overflow behavior to metric columns in the Columns section. |
| docs/api/metrics.rst | Updates API docs to list the newly added data metrics and renamed null-fraction metric. |
| tests/test_metrics.py | Adds unit tests for new data metrics and renames null-fraction test targets. |
| tests/cli/test_cli.py | Updates CLI metric-selection test to use the new data-metric preset label. |
| tests/summary/fixtures/metrics_null_fraction/test_metrics_null_fraction.py | Updates fixture generator test to use the expanded data-metric preset set. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_True_top_True_slim_True_sample_rows_True_sample_pk_True.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_True_top_True_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_True_top_True_slim_False_sample_rows_True_sample_pk_True.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_False_top_True_slim_True_sample_rows_True_sample_pk_True.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_False_top_True_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_False_top_True_slim_False_sample_rows_True_sample_pk_True.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_False_top_True_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_True_top_True_slim_True_sample_rows_True_sample_pk_True.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_True_top_True_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_True_sample_pk_True.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_False_top_True_slim_True_sample_rows_True_sample_pk_True.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_False_top_True_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_False_top_True_slim_False_sample_rows_True_sample_pk_True.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_False_top_True_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for new/wrapped metric headers. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_True_top_False_slim_True_sample_rows_True_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_True_top_False_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_True_top_False_slim_False_sample_rows_True_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_True_top_False_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_False_top_False_slim_True_sample_rows_True_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_False_top_False_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_False_top_False_slim_False_sample_rows_True_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_False_top_False_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_True_top_True_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_True_top_False_slim_True_sample_rows_True_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_True_top_False_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_True_top_False_slim_False_sample_rows_True_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_True_top_False_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_False_top_True_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_False_top_True_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_False_top_False_slim_True_sample_rows_True_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_False_top_False_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_False_top_False_slim_False_sample_rows_True_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_False_top_False_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for expanded data metrics in the Columns table. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_True_slim_True_sample_rows_True_sample_pk_True.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_True_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_True_slim_False_sample_rows_True_sample_pk_True.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_False_slim_True_sample_rows_True_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_False_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_False_slim_False_sample_rows_True_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_False_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_False_top_True_slim_True_sample_rows_True_sample_pk_True.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_False_top_True_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_False_top_False_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_False_top_False_slim_False_sample_rows_True_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_False_top_False_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_True_slim_True_sample_rows_True_sample_pk_True.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_True_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_True_sample_pk_True.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_False_slim_True_sample_rows_True_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_False_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_False_slim_False_sample_rows_True_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_False_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_True_slim_True_sample_rows_True_sample_pk_True.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_True_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_True_slim_False_sample_rows_True_sample_pk_True.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_True_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_False_slim_True_sample_rows_True_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_False_slim_True_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_False_slim_False_sample_rows_True_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
| tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_False_slim_False_sample_rows_False_sample_pk_False.txt | Golden fixture updated for wrapped headers with long metric labels. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Didn't we want to introduce a new section? 😄
There was a problem hiding this comment.
I thought we do that later (as long as you do not mix data and change metrics, the current setup is fine IMO). But I can also work on it before we merge this PR
There was a problem hiding this comment.
Ah, I meant it's fine within the context of the previous PR, I'd rather change it as we extend metrics 😄
There was a problem hiding this comment.
Okay I will add the new section in a separate PR and redraft this one until then
There was a problem hiding this comment.
Motivation
Building on #43, we would like to provide a few more "data" metrics, this time for numeric columns only.
Changes