polars-data-profiling 0.1.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/PKG-INFO +1 -1
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/pyproject.toml +1 -1
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/pyproject.toml.orig +1 -1
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/compare_reports.py +5 -4
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/config.py +44 -4
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/config_default.yaml +1 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/config_minimal.yaml +1 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/alerts.py +6 -2
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/correlations.py +46 -12
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/describe.py +7 -3
- polars_data_profiling-0.3.0/src/polars_data_profiling/model/duplicates.py +126 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/engine.py +16 -6
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/missing.py +20 -13
- polars_data_profiling-0.3.0/src/polars_data_profiling/model/probe.py +336 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/summaries.py +155 -9
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/summary.py +10 -3
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/formatters.py +37 -0
- polars_data_profiling-0.3.0/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_high_cardinality.html +1 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_boolean.py +7 -2
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_categorical.py +7 -3
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_complex.py +2 -1
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_count.py +2 -1
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_date.py +7 -2
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_real.py +2 -1
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_text.py +9 -2
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_timeseries.py +2 -1
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_url.py +7 -2
- polars_data_profiling-0.3.0/src/polars_data_profiling/utils/memory.py +206 -0
- polars_data_profiling-0.1.0/src/polars_data_profiling/model/duplicates.py +0 -64
- polars_data_profiling-0.1.0/src/polars_data_profiling/model/probe.py +0 -217
- polars_data_profiling-0.1.0/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_high_cardinality.html +0 -1
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/LICENSE +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/NOTICE +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/README.md +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/controller/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/controller/console.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/controller/namespace.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/dataframe.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/description.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/expressions.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/handler.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/images.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/pairwise.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/sample.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/summarizer.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/summary_algorithms.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/table.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/timeseries.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/timeseries_index.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/type_rules.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/typeset.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/typeset_base.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/typeset_relations.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/profile_report.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/py.typed +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/alerts.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/collapse.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/container.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/correlation_table.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/dropdown.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/duplicate.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/frequency_table.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/frequency_table_small.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/html.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/image.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/item_renderer.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/renderable.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/root.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/sample.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/scores.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/table.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/toggle_button.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/variable.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/variable_info.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/flavour_html.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/flavour_widget.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/flavours.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/alerts.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/collapse.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/container.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/correlation_table.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/dropdown.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/duplicate.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/frame_table.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/frequency_table.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/frequency_table_small.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/html.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/image.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/root.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/sample.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/scores.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/table.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_constant.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_constant_length.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_dirty_category.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_duplicates.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_empty.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_high_correlation.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_imbalance.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_infinite.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_missing.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_near_duplicates.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_non_stationary.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_seasonal.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_skewed.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_truncated.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_type_date.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_uniform.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_unique.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_unsupported.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_zeros.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/collapse.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/correlation_table.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/diagram.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/dropdown.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/duplicate.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/frequency_table.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/frequency_table_small.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/report.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sample.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/scores.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/batch_grid.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/cards.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/correlations.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/grid.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/interactions.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/list.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/named_list.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/overview_tabs.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/scores.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/sections.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/select.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/tabs.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/table.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/toggle_button.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/variable.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/variable_info.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/bootstrap.bundle.min.js +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/bootstrap.min.css +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/cosmo.bootstrap.min.css +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/flatly.bootstrap.min.css +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/script.js +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/simplex.bootstrap.min.css +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/style.css +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/united.bootstrap.min.css +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/footer.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/javascript.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/navigation.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/style.html +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/theme.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/toggle_button.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/variable.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/variable_info.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/alerts.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/collapse.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/container.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/correlation_table.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/dropdown.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/duplicate.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/frequency_table.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/frequency_table_small.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/html.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/image.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/notebook.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/root.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/sample.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/table.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/toggle_button.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/variable.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/variable_info.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/frequency_table_utils.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/correlations.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/overview.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/report.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_common.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_file.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_generic.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_image.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_path.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/utils.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/serialize_report.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/collect.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/common.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/dataframe.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/notebook.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/paths.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/progress_bar.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/styles.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/version.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/charts/__init__.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/charts/builders.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/charts/palette.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/charts/scales.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/charts/specs.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/charts/svg.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/missing.py +0 -0
- {polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/plot.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: polars-data-profiling
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Polars-native, lazy data profiling reports (a pandas-free fork of ydata-profiling).
|
|
5
5
|
Keywords: data-profiling,data-quality,eda,lazyframe,polars,profiling,report
|
|
6
6
|
Author: Drew Adlof
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
# =============================================================================
|
|
10
10
|
[project]
|
|
11
11
|
name = "polars-data-profiling"
|
|
12
|
-
version = "0.
|
|
12
|
+
version = "0.3.0"
|
|
13
13
|
description = "Polars-native, lazy data profiling reports (a pandas-free fork of ydata-profiling)."
|
|
14
14
|
readme = "README.md"
|
|
15
15
|
requires-python = ">=3.11"
|
|
@@ -20,10 +20,11 @@ def _should_wrap(v1: Any, v2: Any) -> bool:
|
|
|
20
20
|
if isinstance(v1, (list, dict)):
|
|
21
21
|
return False
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
# Frames compare element-wise with ``==``: compare them whole, and a frame
|
|
24
|
+
# with anything else (None when one report did not compute it) as unequal
|
|
25
|
+
frames = (pl.DataFrame, pl.Series)
|
|
26
|
+
if isinstance(v1, frames) or isinstance(v2, frames):
|
|
27
|
+
return type(v1) is type(v2) and v1.equals(v2)
|
|
27
28
|
|
|
28
29
|
try:
|
|
29
30
|
return v1 == v2
|
{polars_data_profiling-0.1.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/config.py
RENAMED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import warnings
|
|
4
4
|
from enum import Enum
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any, Literal
|
|
7
7
|
|
|
8
8
|
import yaml
|
|
9
9
|
from pydantic import BaseModel as _PydanticModel
|
|
@@ -145,6 +145,15 @@ class Univariate(BaseModel):
|
|
|
145
145
|
file: FileVars = FileVars()
|
|
146
146
|
url: UrlVars = UrlVars()
|
|
147
147
|
timeseries: TimeseriesVars = TimeseriesVars()
|
|
148
|
+
# "exact": count the values of every column (value counts, which hold every
|
|
149
|
+
# distinct value in memory). "approximate": near-unique columns, whose
|
|
150
|
+
# estimated distinct count exceeds value_counts_max_distinct_ratio of their
|
|
151
|
+
# values (and inference's exact count bound), skip their value counts: no
|
|
152
|
+
# frequency table, top value or extreme values. Their distinct count is
|
|
153
|
+
# exact up to 65,536 distinct values, and an estimate (about 0.5% off,
|
|
154
|
+
# shown with "≈") above that.
|
|
155
|
+
distinct_count: Literal["exact", "approximate"] = "exact"
|
|
156
|
+
value_counts_max_distinct_ratio: float = Field(default=0.5, ge=0, le=1)
|
|
148
157
|
|
|
149
158
|
|
|
150
159
|
class MissingPlot(BaseModel):
|
|
@@ -309,8 +318,12 @@ class Html(BaseModel):
|
|
|
309
318
|
|
|
310
319
|
|
|
311
320
|
class Duplicates(BaseModel):
|
|
321
|
+
# Most frequent duplicated rows shown (0: no table of rows)
|
|
312
322
|
head: int = 10
|
|
313
323
|
key: str = "# duplicates"
|
|
324
|
+
# Count the duplicated rows (n_duplicates, p_duplicates and their alert),
|
|
325
|
+
# also when no rows are shown
|
|
326
|
+
count: bool = True
|
|
314
327
|
|
|
315
328
|
|
|
316
329
|
class Correlation(BaseModel):
|
|
@@ -370,8 +383,34 @@ class Engine(BaseModel):
|
|
|
370
383
|
# which lowers peak memory on very large Parquet files at the cost of more
|
|
371
384
|
# reads.
|
|
372
385
|
share_scans: bool = True
|
|
373
|
-
#
|
|
386
|
+
# How queries trade memory for speed; never what the report contains.
|
|
387
|
+
# "fast": Polars' default engine for small frames, streaming otherwise, 16
|
|
388
|
+
# columns per pass. "low_memory": streaming, 4 columns per pass, and aggregations
|
|
389
|
+
# that change a column's length (the date sample) in their own select.
|
|
390
|
+
# "auto": "fast" when about three times the data fits in half of the
|
|
391
|
+
# available memory, "low_memory" otherwise (see utils.memory).
|
|
392
|
+
memory_mode: Literal["auto", "fast", "low_memory"] = "auto"
|
|
393
|
+
# Polars engine used to collect: "in-memory", "streaming" or "gpu". "auto":
|
|
394
|
+
# streaming, except for small frames in "fast" mode, where Polars chooses
|
|
374
395
|
collect_engine: str = "auto"
|
|
396
|
+
# Most columns whose aggregations are evaluated in one pass (type inference,
|
|
397
|
+
# variable summaries and the missing-values matrix). None: all of them.
|
|
398
|
+
# "auto": chosen by memory_mode (16, or 4 in low_memory). On very wide
|
|
399
|
+
# tables a bound lowers peak memory; a projected source (Parquet) makes the
|
|
400
|
+
# extra passes cheap.
|
|
401
|
+
max_columns_per_pass: int | Literal["auto"] | None = "auto"
|
|
402
|
+
|
|
403
|
+
@property
|
|
404
|
+
def columns_per_pass(self) -> int | None:
|
|
405
|
+
"""``max_columns_per_pass``, with "auto" resolved by ``memory_mode``."""
|
|
406
|
+
if self.max_columns_per_pass != "auto":
|
|
407
|
+
return self.max_columns_per_pass
|
|
408
|
+
return 4 if self.memory_mode == "low_memory" else 16
|
|
409
|
+
|
|
410
|
+
@property
|
|
411
|
+
def low_memory(self) -> bool:
|
|
412
|
+
"""Whether queries are arranged for the lowest peak memory."""
|
|
413
|
+
return self.memory_mode == "low_memory"
|
|
375
414
|
|
|
376
415
|
|
|
377
416
|
class Report(BaseModel):
|
|
@@ -472,7 +511,8 @@ class Config:
|
|
|
472
511
|
arg_groups: dict[str, Any] = {
|
|
473
512
|
"sensitive": {
|
|
474
513
|
"samples": None,
|
|
475
|
-
|
|
514
|
+
# The duplicated rows show values; their count does not
|
|
515
|
+
"duplicates": {"head": 0, "count": True},
|
|
476
516
|
"vars": {"cat": {"redact": True}, "text": {"redact": True}},
|
|
477
517
|
},
|
|
478
518
|
# Kept for backwards compatibility: the Bootswatch themes are gone,
|
|
@@ -518,7 +558,7 @@ class Config:
|
|
|
518
558
|
"url": "",
|
|
519
559
|
},
|
|
520
560
|
"samples": {"head": 0, "tail": 0, "random": 0},
|
|
521
|
-
"duplicates": {"head": 0},
|
|
561
|
+
"duplicates": {"head": 0, "count": False},
|
|
522
562
|
"interactions": {"targets": [], "continuous": False},
|
|
523
563
|
"missing_diagrams": {
|
|
524
564
|
"bar": False,
|
|
@@ -271,7 +271,8 @@ class HighCardinalityAlert(Alert):
|
|
|
271
271
|
|
|
272
272
|
def _get_description(self) -> str:
|
|
273
273
|
if self.values is not None:
|
|
274
|
-
|
|
274
|
+
about = "about " if self.values.get("n_distinct_estimated") else ""
|
|
275
|
+
return f"[{self.column_name}] has {about}{self.values['n_distinct']:} ({fmt_percent(self.values['p_distinct'])}) distinct values"
|
|
275
276
|
else:
|
|
276
277
|
return f"[{self.column_name}] has a high cardinality"
|
|
277
278
|
|
|
@@ -677,7 +678,10 @@ def generic_alerts(summary: dict) -> list[Alert]:
|
|
|
677
678
|
def supported_alerts(summary: dict) -> list[Alert]:
|
|
678
679
|
alerts: list[Alert] = []
|
|
679
680
|
|
|
680
|
-
|
|
681
|
+
# An estimated distinct count cannot tell that every value is unique
|
|
682
|
+
if summary.get("n_distinct", np.nan) == summary["n"] and not summary.get(
|
|
683
|
+
"n_distinct_estimated"
|
|
684
|
+
):
|
|
681
685
|
alerts.append(UniqueAlert())
|
|
682
686
|
if summary.get("n_distinct", np.nan) == 1:
|
|
683
687
|
alerts.append(ConstantAlert(summary))
|
|
@@ -196,18 +196,51 @@ def cramers_compute(
|
|
|
196
196
|
return _matrix_frame(columns, matrix)
|
|
197
197
|
|
|
198
198
|
|
|
199
|
-
def _discretized(
|
|
200
|
-
|
|
199
|
+
def _discretized(
|
|
200
|
+
column: str, low: float | None, high: float | None, n_bins: int
|
|
201
|
+
) -> pl.Expr:
|
|
202
|
+
"""Equal-width bins over [low, high], labelled 0..n_bins-1 (as pd.cut).
|
|
203
|
+
|
|
204
|
+
The bounds are values, not ``min()``/``max()`` expressions: crosstab queries
|
|
205
|
+
over a frame that broadcasts aggregations fail in Polars' in-memory
|
|
206
|
+
``collect_all`` on CSV and NDJSON scans (#14), and every query would
|
|
207
|
+
compute them again. Missing or NaN bounds, or a single value, put every
|
|
208
|
+
row in bin 0.
|
|
209
|
+
"""
|
|
210
|
+
width = None if low is None or high is None else (high - low) / n_bins
|
|
211
|
+
if width is None or not width > 0:
|
|
212
|
+
return pl.lit(0, dtype=pl.Int64).alias(column)
|
|
201
213
|
x = pl.col(column).cast(pl.Float64)
|
|
202
|
-
low
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
214
|
+
return ((x - low) / width).floor().clip(0, n_bins - 1).cast(pl.Int64).alias(column)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def _bin_bounds(
|
|
218
|
+
df: pl.LazyFrame, columns: Sequence[str], summary: dict
|
|
219
|
+
) -> dict[str, tuple[float | None, float | None]]:
|
|
220
|
+
"""The smallest and largest value of each numeric column.
|
|
221
|
+
|
|
222
|
+
They come from the column descriptions; a query computes those that a
|
|
223
|
+
description lacks (a custom summarizer, for example).
|
|
224
|
+
"""
|
|
225
|
+
bounds = {}
|
|
226
|
+
missing = []
|
|
227
|
+
for name in columns:
|
|
228
|
+
low, high = summary[name].get("min"), summary[name].get("max")
|
|
229
|
+
if low is None or high is None:
|
|
230
|
+
missing.append(name)
|
|
231
|
+
else:
|
|
232
|
+
bounds[name] = (float(low), float(high))
|
|
233
|
+
if missing:
|
|
234
|
+
x = [pl.col(c).cast(pl.Float64) for c in missing]
|
|
235
|
+
row = collect(
|
|
236
|
+
df.select(
|
|
237
|
+
*[e.min().alias(f"__min_{i}") for i, e in enumerate(x)],
|
|
238
|
+
*[e.max().alias(f"__max_{i}") for i, e in enumerate(x)],
|
|
239
|
+
)
|
|
240
|
+
).row(0)
|
|
241
|
+
for i, name in enumerate(missing):
|
|
242
|
+
bounds[name] = (row[i], row[len(missing) + i])
|
|
243
|
+
return bounds
|
|
211
244
|
|
|
212
245
|
|
|
213
246
|
def auto_compute(
|
|
@@ -243,8 +276,9 @@ def auto_compute(
|
|
|
243
276
|
if a in categorical or b in categorical
|
|
244
277
|
]
|
|
245
278
|
if mixed_pairs:
|
|
279
|
+
bounds = _bin_bounds(df, numeric, summary)
|
|
246
280
|
binned = df.select(
|
|
247
|
-
[_discretized(
|
|
281
|
+
[_discretized(c, *bounds[c], n_bins) for c in numeric]
|
|
248
282
|
+ [pl.col(c) for c in categorical]
|
|
249
283
|
)
|
|
250
284
|
for (a, b), table in zip(mixed_pairs, _crosstabs(binned, mixed_pairs)):
|
|
@@ -32,6 +32,7 @@ from polars_data_profiling.model.timeseries_index import get_time_index_descript
|
|
|
32
32
|
from polars_data_profiling.model.typeset_base import BaseTypeSet
|
|
33
33
|
from polars_data_profiling.utils.collect import use_engine
|
|
34
34
|
from polars_data_profiling.utils.dataframe import to_lazyframe
|
|
35
|
+
from polars_data_profiling.utils.memory import resolve_engine
|
|
35
36
|
from polars_data_profiling.utils.progress_bar import progress
|
|
36
37
|
from polars_data_profiling.version import __version__
|
|
37
38
|
|
|
@@ -63,18 +64,21 @@ def describe(
|
|
|
63
64
|
"""
|
|
64
65
|
if not isinstance(config, Settings):
|
|
65
66
|
raise TypeError(f"`config` must be of type `Settings`, got {type(config)}")
|
|
67
|
+
lf = to_lazyframe(df)
|
|
68
|
+
# Every "auto" engine setting replaced by its choice, which the report records
|
|
69
|
+
config = resolve_engine(config, df if isinstance(df, pl.DataFrame) else lf)
|
|
66
70
|
with use_engine(config.engine.collect_engine):
|
|
67
|
-
return _describe(config,
|
|
71
|
+
return _describe(config, lf, summarizer, typeset, sample)
|
|
68
72
|
|
|
69
73
|
|
|
70
74
|
def _describe(
|
|
71
75
|
config: Settings,
|
|
72
|
-
df: pl.LazyFrame
|
|
76
|
+
df: pl.LazyFrame,
|
|
73
77
|
summarizer: BaseSummarizer,
|
|
74
78
|
typeset: BaseTypeSet,
|
|
75
79
|
sample: dict | None,
|
|
76
80
|
) -> BaseDescription:
|
|
77
|
-
lf = preprocess(config,
|
|
81
|
+
lf = preprocess(config, df)
|
|
78
82
|
if config.engine.share_scans:
|
|
79
83
|
# Queries collected together read the source once
|
|
80
84
|
lf = lf.cache()
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"""Duplicate rows.
|
|
2
|
+
|
|
3
|
+
Grouping by the rows themselves keeps every distinct row in a hash table: a
|
|
4
|
+
copy of the data when most rows are distinct. Duplicates are found in two
|
|
5
|
+
steps instead:
|
|
6
|
+
|
|
7
|
+
1. :func:`duplicate_candidates` groups the rows by a 64-bit hash, which keeps
|
|
8
|
+
16 bytes per distinct row, and returns the hashes seen more than once. Most
|
|
9
|
+
frames have none, and stop there.
|
|
10
|
+
2. :func:`duplicated_rows` groups by their values only the rows with one of
|
|
11
|
+
these hashes. Rows that merely share a hash (a collision) end up in groups
|
|
12
|
+
of one and are dropped, so the result is exact.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from collections.abc import Sequence
|
|
18
|
+
from functools import reduce
|
|
19
|
+
from typing import Any
|
|
20
|
+
|
|
21
|
+
import polars as pl
|
|
22
|
+
|
|
23
|
+
from polars_data_profiling.config import Settings
|
|
24
|
+
from polars_data_profiling.utils.collect import collect, collect_all
|
|
25
|
+
|
|
26
|
+
# Multiplier combining the column hashes (the 64-bit FNV prime).
|
|
27
|
+
_MIX = 0x100000001B3
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def row_hash(columns: Sequence[str]) -> pl.Expr:
|
|
31
|
+
"""A 64-bit hash of each row over ``columns``.
|
|
32
|
+
|
|
33
|
+
Each column is hashed on its own (with its position as seed) and the hashes
|
|
34
|
+
are combined. Hashing ``pl.struct(columns)`` gives the same kind of result
|
|
35
|
+
but builds the struct of every column first, which costs about as much
|
|
36
|
+
memory as the rows themselves.
|
|
37
|
+
"""
|
|
38
|
+
hashes = [pl.col(name).hash(seed=i) for i, name in enumerate(columns)]
|
|
39
|
+
return reduce(lambda acc, h: acc * _MIX + h, hashes[1:], hashes[0])
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def duplicate_candidates(df: pl.LazyFrame, columns: Sequence[str]) -> pl.Series:
|
|
43
|
+
"""The row hashes seen more than once."""
|
|
44
|
+
hashes = df.select(row_hash(columns).alias("hash"))
|
|
45
|
+
candidates = hashes.group_by("hash").len().filter(pl.col("len") > 1)
|
|
46
|
+
return collect(candidates.select("hash")).to_series()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def duplicated_rows(
|
|
50
|
+
df: pl.LazyFrame, columns: Sequence[str], key: str, candidates: pl.Series
|
|
51
|
+
) -> pl.LazyFrame:
|
|
52
|
+
"""The rows that occur more than once, with their count in ``key``.
|
|
53
|
+
|
|
54
|
+
Only the rows whose hash is among ``candidates`` are grouped.
|
|
55
|
+
"""
|
|
56
|
+
return (
|
|
57
|
+
df.filter(row_hash(columns).is_in(candidates.implode()))
|
|
58
|
+
.group_by(columns)
|
|
59
|
+
.len(name=key)
|
|
60
|
+
.filter(pl.col(key) > 1)
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def get_duplicates(
|
|
65
|
+
config: Settings,
|
|
66
|
+
df: pl.LazyFrame,
|
|
67
|
+
supported_columns: Sequence[str],
|
|
68
|
+
n_rows: int,
|
|
69
|
+
) -> tuple[dict[str, Any], pl.DataFrame | None]:
|
|
70
|
+
"""The most frequent duplicated rows (see the module docstring).
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
config: report settings.
|
|
74
|
+
df: the frame.
|
|
75
|
+
supported_columns: the columns that identify a row.
|
|
76
|
+
n_rows: number of rows of the frame.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
``n_duplicates`` (the number of distinct rows that occur more than once)
|
|
80
|
+
and ``p_duplicates`` when ``duplicates.count`` is on, and the
|
|
81
|
+
``duplicates.head`` most frequent of these rows with their number of
|
|
82
|
+
occurrences (``None`` when ``head`` is 0, so that no row is shown).
|
|
83
|
+
"""
|
|
84
|
+
n_head = config.duplicates.head
|
|
85
|
+
count_only = n_head <= 0
|
|
86
|
+
metrics: dict[str, Any] = {}
|
|
87
|
+
if count_only and not config.duplicates.count:
|
|
88
|
+
return metrics, None
|
|
89
|
+
schema = df.collect_schema()
|
|
90
|
+
key = config.duplicates.key
|
|
91
|
+
if key in schema:
|
|
92
|
+
raise ValueError(
|
|
93
|
+
f"Duplicates key ({key}) may not be part of the DataFrame. Either change the "
|
|
94
|
+
f" column name in the DataFrame or change the 'duplicates.key' parameter."
|
|
95
|
+
)
|
|
96
|
+
columns = list(supported_columns)
|
|
97
|
+
if not columns or n_rows == 0:
|
|
98
|
+
metrics["n_duplicates"] = 0
|
|
99
|
+
metrics["p_duplicates"] = 0.0
|
|
100
|
+
return metrics, None
|
|
101
|
+
|
|
102
|
+
candidates = duplicate_candidates(df, columns)
|
|
103
|
+
groups = duplicated_rows(df, columns, key, candidates)
|
|
104
|
+
if candidates.is_empty():
|
|
105
|
+
# No two rows share a hash: no duplicates, and no second pass
|
|
106
|
+
metrics["n_duplicates"] = 0
|
|
107
|
+
metrics["p_duplicates"] = 0.0
|
|
108
|
+
top = None if count_only else pl.DataFrame(schema=groups.collect_schema())
|
|
109
|
+
return metrics, top
|
|
110
|
+
|
|
111
|
+
if count_only:
|
|
112
|
+
n_duplicates = collect(groups.select(pl.len())).item()
|
|
113
|
+
metrics["n_duplicates"] = int(n_duplicates)
|
|
114
|
+
metrics["p_duplicates"] = n_duplicates / n_rows
|
|
115
|
+
return metrics, None
|
|
116
|
+
|
|
117
|
+
counts, top = collect_all(
|
|
118
|
+
[
|
|
119
|
+
groups.select(pl.len()),
|
|
120
|
+
groups.sort(key, descending=True, maintain_order=True).head(n_head),
|
|
121
|
+
]
|
|
122
|
+
)
|
|
123
|
+
n_duplicates = counts.item()
|
|
124
|
+
metrics["n_duplicates"] = int(n_duplicates)
|
|
125
|
+
metrics["p_duplicates"] = n_duplicates / n_rows
|
|
126
|
+
return metrics, top
|
|
@@ -26,7 +26,7 @@ materialises what it needs with :meth:`ColumnRef.series`.
|
|
|
26
26
|
from __future__ import annotations
|
|
27
27
|
|
|
28
28
|
import inspect
|
|
29
|
-
from collections.abc import Callable, Generator, Hashable, Iterable, Mapping
|
|
29
|
+
from collections.abc import Callable, Generator, Hashable, Iterable, Iterator, Mapping
|
|
30
30
|
from dataclasses import dataclass, field
|
|
31
31
|
from typing import Any
|
|
32
32
|
|
|
@@ -97,6 +97,7 @@ def run_plans(
|
|
|
97
97
|
frame: pl.LazyFrame,
|
|
98
98
|
plans: Mapping[Hashable, Plan | Any],
|
|
99
99
|
on_done: Callable[[Hashable], None] | None = None,
|
|
100
|
+
max_plans_per_pass: int | None = None,
|
|
100
101
|
) -> dict[Hashable, Any]:
|
|
101
102
|
"""Drive several plans to completion, batching their requests.
|
|
102
103
|
|
|
@@ -105,6 +106,9 @@ def run_plans(
|
|
|
105
106
|
plans: plans keyed by an identifier. A value that is not a generator is
|
|
106
107
|
taken as an already-computed result.
|
|
107
108
|
on_done: called with the key of each plan as it finishes.
|
|
109
|
+
max_plans_per_pass: evaluate the requests of at most this many plans
|
|
110
|
+
together, one group after the other (``None``: all of them). Fewer
|
|
111
|
+
plans per pass lower peak memory at the cost of more passes.
|
|
108
112
|
|
|
109
113
|
Returns:
|
|
110
114
|
The return value of every plan, by key.
|
|
@@ -137,15 +141,21 @@ def run_plans(
|
|
|
137
141
|
while waiting:
|
|
138
142
|
batch = dict(waiting)
|
|
139
143
|
waiting.clear()
|
|
140
|
-
|
|
141
|
-
frame, {key:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
advance(key, plan, responses[key])
|
|
144
|
+
for group in chunks(list(batch), max_plans_per_pass):
|
|
145
|
+
responses = _evaluate(frame, {key: batch[key][1] for key in group})
|
|
146
|
+
for key in group:
|
|
147
|
+
advance(key, batch[key][0], responses[key])
|
|
145
148
|
|
|
146
149
|
return results
|
|
147
150
|
|
|
148
151
|
|
|
152
|
+
def chunks(keys: list[Any], size: int | None) -> Iterator[list[Any]]:
|
|
153
|
+
"""Split ``keys`` into groups of at most ``size`` (``None`` or 0: one group)."""
|
|
154
|
+
step = size if size else max(len(keys), 1)
|
|
155
|
+
for start in range(0, len(keys), step):
|
|
156
|
+
yield keys[start : start + step]
|
|
157
|
+
|
|
158
|
+
|
|
149
159
|
def _evaluate(
|
|
150
160
|
frame: pl.LazyFrame, requests: Mapping[Hashable, Request]
|
|
151
161
|
) -> dict[Hashable, Response]:
|
|
@@ -11,6 +11,7 @@ import numpy as np
|
|
|
11
11
|
import polars as pl
|
|
12
12
|
|
|
13
13
|
from polars_data_profiling.config import Settings
|
|
14
|
+
from polars_data_profiling.model.engine import chunks
|
|
14
15
|
from polars_data_profiling.utils.collect import collect
|
|
15
16
|
from polars_data_profiling.visualisation.charts.builders import MAX_MATRIX_BANDS
|
|
16
17
|
from polars_data_profiling.visualisation.missing import (
|
|
@@ -36,23 +37,29 @@ def missing_matrix(
|
|
|
36
37
|
) -> str:
|
|
37
38
|
"""Share of non-missing values per column in horizontal bands of rows.
|
|
38
39
|
|
|
39
|
-
The rows are split into at most ``MAX_MATRIX_BANDS`` bands and the
|
|
40
|
-
are
|
|
40
|
+
The rows are split into at most ``MAX_MATRIX_BANDS`` bands and the values
|
|
41
|
+
of each band are counted by a lazy group-by over a row index, so only a
|
|
42
|
+
small matrix is collected and the streaming engine holds one count per band
|
|
43
|
+
and column. Each query counts at most ``engine.max_columns_per_pass``
|
|
44
|
+
columns.
|
|
41
45
|
"""
|
|
42
46
|
columns = list(variables)
|
|
43
47
|
n_bands = max(1, min(MAX_MATRIX_BANDS, n_rows))
|
|
44
|
-
band = (pl.
|
|
45
|
-
|
|
46
|
-
)
|
|
47
|
-
shares = collect(
|
|
48
|
-
df.select(band, *[pl.col(c).is_not_null().cast(pl.Float64) for c in columns])
|
|
49
|
-
.group_by("__band")
|
|
50
|
-
.mean()
|
|
51
|
-
.sort("__band")
|
|
52
|
-
)
|
|
53
|
-
bands = shares.get_column("__band").to_numpy()
|
|
48
|
+
band = (pl.col("__band").cast(pl.Int64) * n_bands // max(n_rows, 1)).alias("__band")
|
|
49
|
+
indexed = df.with_row_index("__band")
|
|
54
50
|
fractions = np.ones((n_bands, len(columns)))
|
|
55
|
-
|
|
51
|
+
start = 0
|
|
52
|
+
for group in chunks(columns, config.engine.columns_per_pass):
|
|
53
|
+
shares = collect(
|
|
54
|
+
indexed.group_by(band)
|
|
55
|
+
.agg(pl.len().alias("__n"), *[pl.col(c).count() for c in group])
|
|
56
|
+
.select("__band", *[(pl.col(c) / pl.col("__n")).alias(c) for c in group])
|
|
57
|
+
.sort("__band")
|
|
58
|
+
)
|
|
59
|
+
bands = shares.get_column("__band").to_numpy()
|
|
60
|
+
stop = start + len(group)
|
|
61
|
+
fractions[bands, start:stop] = shares.select(group).to_numpy()
|
|
62
|
+
start = stop
|
|
56
63
|
return plot_missing_matrix(config, notnull=fractions, columns=columns, nrows=n_rows)
|
|
57
64
|
|
|
58
65
|
|