polars-data-profiling 0.1.0__tar.gz → 0.2.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.
Files changed (208) hide show
  1. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/PKG-INFO +1 -1
  2. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/pyproject.toml +1 -1
  3. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/pyproject.toml.orig +1 -1
  4. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/compare_reports.py +5 -4
  5. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/config.py +12 -2
  6. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/config_default.yaml +1 -0
  7. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/config_minimal.yaml +1 -0
  8. polars_data_profiling-0.2.0/src/polars_data_profiling/model/duplicates.py +126 -0
  9. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/engine.py +16 -6
  10. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/probe.py +129 -33
  11. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/summaries.py +4 -3
  12. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/summary.py +10 -3
  13. polars_data_profiling-0.1.0/src/polars_data_profiling/model/duplicates.py +0 -64
  14. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/LICENSE +0 -0
  15. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/NOTICE +0 -0
  16. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/README.md +0 -0
  17. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/__init__.py +0 -0
  18. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/controller/__init__.py +0 -0
  19. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/controller/console.py +0 -0
  20. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/controller/namespace.py +0 -0
  21. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/__init__.py +0 -0
  22. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/alerts.py +0 -0
  23. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/correlations.py +0 -0
  24. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/dataframe.py +0 -0
  25. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/describe.py +0 -0
  26. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/description.py +0 -0
  27. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/expressions.py +0 -0
  28. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/handler.py +0 -0
  29. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/images.py +0 -0
  30. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/missing.py +0 -0
  31. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/pairwise.py +0 -0
  32. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/sample.py +0 -0
  33. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/summarizer.py +0 -0
  34. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/summary_algorithms.py +0 -0
  35. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/table.py +0 -0
  36. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/timeseries.py +0 -0
  37. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/timeseries_index.py +0 -0
  38. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/type_rules.py +0 -0
  39. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/typeset.py +0 -0
  40. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/typeset_base.py +0 -0
  41. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/model/typeset_relations.py +0 -0
  42. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/profile_report.py +0 -0
  43. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/py.typed +0 -0
  44. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/__init__.py +0 -0
  45. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/formatters.py +0 -0
  46. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/__init__.py +0 -0
  47. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/__init__.py +0 -0
  48. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/alerts.py +0 -0
  49. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/collapse.py +0 -0
  50. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/container.py +0 -0
  51. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/correlation_table.py +0 -0
  52. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/dropdown.py +0 -0
  53. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/duplicate.py +0 -0
  54. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/frequency_table.py +0 -0
  55. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/frequency_table_small.py +0 -0
  56. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/html.py +0 -0
  57. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/image.py +0 -0
  58. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/item_renderer.py +0 -0
  59. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/renderable.py +0 -0
  60. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/root.py +0 -0
  61. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/sample.py +0 -0
  62. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/scores.py +0 -0
  63. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/table.py +0 -0
  64. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/toggle_button.py +0 -0
  65. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/variable.py +0 -0
  66. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/core/variable_info.py +0 -0
  67. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/__init__.py +0 -0
  68. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/flavour_html.py +0 -0
  69. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/flavour_widget.py +0 -0
  70. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/flavours.py +0 -0
  71. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/__init__.py +0 -0
  72. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/alerts.py +0 -0
  73. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/collapse.py +0 -0
  74. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/container.py +0 -0
  75. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/correlation_table.py +0 -0
  76. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/dropdown.py +0 -0
  77. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/duplicate.py +0 -0
  78. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/frame_table.py +0 -0
  79. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/frequency_table.py +0 -0
  80. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/frequency_table_small.py +0 -0
  81. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/html.py +0 -0
  82. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/image.py +0 -0
  83. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/root.py +0 -0
  84. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/sample.py +0 -0
  85. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/scores.py +0 -0
  86. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/table.py +0 -0
  87. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_constant.html +0 -0
  88. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_constant_length.html +0 -0
  89. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_dirty_category.html +0 -0
  90. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_duplicates.html +0 -0
  91. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_empty.html +0 -0
  92. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_high_cardinality.html +0 -0
  93. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_high_correlation.html +0 -0
  94. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_imbalance.html +0 -0
  95. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_infinite.html +0 -0
  96. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_missing.html +0 -0
  97. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_near_duplicates.html +0 -0
  98. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_non_stationary.html +0 -0
  99. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_seasonal.html +0 -0
  100. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_skewed.html +0 -0
  101. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_truncated.html +0 -0
  102. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_type_date.html +0 -0
  103. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_uniform.html +0 -0
  104. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_unique.html +0 -0
  105. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_unsupported.html +0 -0
  106. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_zeros.html +0 -0
  107. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts.html +0 -0
  108. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/collapse.html +0 -0
  109. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/correlation_table.html +0 -0
  110. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/diagram.html +0 -0
  111. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/dropdown.html +0 -0
  112. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/duplicate.html +0 -0
  113. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/frequency_table.html +0 -0
  114. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/frequency_table_small.html +0 -0
  115. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/report.html +0 -0
  116. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sample.html +0 -0
  117. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/scores.html +0 -0
  118. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/batch_grid.html +0 -0
  119. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/cards.html +0 -0
  120. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/correlations.html +0 -0
  121. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/grid.html +0 -0
  122. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/interactions.html +0 -0
  123. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/list.html +0 -0
  124. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/named_list.html +0 -0
  125. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/overview_tabs.html +0 -0
  126. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/scores.html +0 -0
  127. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/sections.html +0 -0
  128. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/select.html +0 -0
  129. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/tabs.html +0 -0
  130. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/table.html +0 -0
  131. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/toggle_button.html +0 -0
  132. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/variable.html +0 -0
  133. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/variable_info.html +0 -0
  134. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/bootstrap.bundle.min.js +0 -0
  135. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/bootstrap.min.css +0 -0
  136. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/cosmo.bootstrap.min.css +0 -0
  137. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/flatly.bootstrap.min.css +0 -0
  138. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/script.js +0 -0
  139. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/simplex.bootstrap.min.css +0 -0
  140. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/style.css +0 -0
  141. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/united.bootstrap.min.css +0 -0
  142. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/footer.html +0 -0
  143. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/javascript.html +0 -0
  144. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/navigation.html +0 -0
  145. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/style.html +0 -0
  146. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/templates.py +0 -0
  147. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/theme.py +0 -0
  148. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/toggle_button.py +0 -0
  149. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/variable.py +0 -0
  150. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/html/variable_info.py +0 -0
  151. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/__init__.py +0 -0
  152. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/alerts.py +0 -0
  153. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/collapse.py +0 -0
  154. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/container.py +0 -0
  155. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/correlation_table.py +0 -0
  156. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/dropdown.py +0 -0
  157. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/duplicate.py +0 -0
  158. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/frequency_table.py +0 -0
  159. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/frequency_table_small.py +0 -0
  160. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/html.py +0 -0
  161. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/image.py +0 -0
  162. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/notebook.py +0 -0
  163. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/root.py +0 -0
  164. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/sample.py +0 -0
  165. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/table.py +0 -0
  166. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/toggle_button.py +0 -0
  167. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/variable.py +0 -0
  168. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/flavours/widget/variable_info.py +0 -0
  169. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/presentation/frequency_table_utils.py +0 -0
  170. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/__init__.py +0 -0
  171. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/correlations.py +0 -0
  172. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/overview.py +0 -0
  173. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/report.py +0 -0
  174. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/__init__.py +0 -0
  175. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_boolean.py +0 -0
  176. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_categorical.py +0 -0
  177. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_common.py +0 -0
  178. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_complex.py +0 -0
  179. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_count.py +0 -0
  180. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_date.py +0 -0
  181. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_file.py +0 -0
  182. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_generic.py +0 -0
  183. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_image.py +0 -0
  184. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_path.py +0 -0
  185. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_real.py +0 -0
  186. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_text.py +0 -0
  187. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_timeseries.py +0 -0
  188. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/structure/variables/render_url.py +0 -0
  189. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/report/utils.py +0 -0
  190. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/serialize_report.py +0 -0
  191. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/utils/__init__.py +0 -0
  192. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/utils/collect.py +0 -0
  193. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/utils/common.py +0 -0
  194. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/utils/dataframe.py +0 -0
  195. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/utils/notebook.py +0 -0
  196. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/utils/paths.py +0 -0
  197. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/utils/progress_bar.py +0 -0
  198. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/utils/styles.py +0 -0
  199. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/version.py +0 -0
  200. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/visualisation/__init__.py +0 -0
  201. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/visualisation/charts/__init__.py +0 -0
  202. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/visualisation/charts/builders.py +0 -0
  203. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/visualisation/charts/palette.py +0 -0
  204. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/visualisation/charts/scales.py +0 -0
  205. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/visualisation/charts/specs.py +0 -0
  206. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/visualisation/charts/svg.py +0 -0
  207. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.0}/src/polars_data_profiling/visualisation/missing.py +0 -0
  208. {polars_data_profiling-0.1.0 → polars_data_profiling-0.2.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.1.0
3
+ Version: 0.2.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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "polars-data-profiling"
3
- version = "0.1.0"
3
+ version = "0.2.0"
4
4
  description = "Polars-native, lazy data profiling reports (a pandas-free fork of ydata-profiling)."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -9,7 +9,7 @@
9
9
  # =============================================================================
10
10
  [project]
11
11
  name = "polars-data-profiling"
12
- version = "0.1.0"
12
+ version = "0.2.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
- if isinstance(v1, pl.DataFrame) and isinstance(v2, pl.DataFrame):
24
- return v1.equals(v2)
25
- if isinstance(v1, pl.Series) and isinstance(v2, pl.Series):
26
- return v1.equals(v2)
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
@@ -309,8 +309,12 @@ class Html(BaseModel):
309
309
 
310
310
 
311
311
  class Duplicates(BaseModel):
312
+ # Most frequent duplicated rows shown (0: no table of rows)
312
313
  head: int = 10
313
314
  key: str = "# duplicates"
315
+ # Count the duplicated rows (n_duplicates, p_duplicates and their alert),
316
+ # also when no rows are shown
317
+ count: bool = True
314
318
 
315
319
 
316
320
  class Correlation(BaseModel):
@@ -372,6 +376,11 @@ class Engine(BaseModel):
372
376
  share_scans: bool = True
373
377
  # Polars engine used to collect: "auto", "in-memory", "streaming" or "gpu"
374
378
  collect_engine: str = "auto"
379
+ # Most columns whose aggregations are evaluated in one pass (type inference
380
+ # and variable summaries). None: all of them. On very wide tables a bound
381
+ # lowers peak memory; a projected source (Parquet) makes the extra passes
382
+ # cheap.
383
+ max_columns_per_pass: int | None = 16
375
384
 
376
385
 
377
386
  class Report(BaseModel):
@@ -472,7 +481,8 @@ class Config:
472
481
  arg_groups: dict[str, Any] = {
473
482
  "sensitive": {
474
483
  "samples": None,
475
- "duplicates": None,
484
+ # The duplicated rows show values; their count does not
485
+ "duplicates": {"head": 0, "count": True},
476
486
  "vars": {"cat": {"redact": True}, "text": {"redact": True}},
477
487
  },
478
488
  # Kept for backwards compatibility: the Bootswatch themes are gone,
@@ -518,7 +528,7 @@ class Config:
518
528
  "url": "",
519
529
  },
520
530
  "samples": {"head": 0, "tail": 0, "random": 0},
521
- "duplicates": {"head": 0},
531
+ "duplicates": {"head": 0, "count": False},
522
532
  "interactions": {"targets": [], "continuous": False},
523
533
  "missing_diagrams": {
524
534
  "bar": False,
@@ -170,6 +170,7 @@ memory_deep: false
170
170
  duplicates:
171
171
  head: 10
172
172
  key: "# duplicates"
173
+ count: true
173
174
 
174
175
  # Configuration related to the samples area
175
176
  samples:
@@ -169,6 +169,7 @@ memory_deep: false
169
169
  duplicates:
170
170
  head: 0
171
171
  key: "# duplicates"
172
+ count: false
172
173
 
173
174
  # Configuration related to the samples area
174
175
  samples:
@@ -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
- responses = _evaluate(
141
- frame, {key: request for key, (_, request) in batch.items()}
142
- )
143
- for key, (plan, _) in batch.items():
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]:
@@ -1,4 +1,4 @@
1
- """Facts about every column, computed in one lazy pass, for type inference.
1
+ """Facts about every column, computed in one or two lazy passes, for type inference.
2
2
 
3
3
  Type inference asks questions such as "do all non-null values of this string
4
4
  column parse as numbers?" or "how many distinct values does it have?". Rather
@@ -9,10 +9,20 @@ in a single ``LazyFrame.select``. The typeset then walks its relations on
9
9
  :class:`InferenceColumn` objects that carry these facts, and transformers
10
10
  return new *expressions* (e.g. the parse of a string column as numbers) rather
11
11
  than converted data.
12
+
13
+ Memory: an exact distinct count keeps a hash set of every value of its column,
14
+ and one select holds the sets of all columns at once. Inference only compares
15
+ distinct counts with small thresholds, so the first pass estimates them
16
+ (``approx_n_unique``, a fixed-size sketch) and a second pass counts exactly the
17
+ columns estimated close to or below a threshold (see
18
+ :func:`exact_count_bound`). Columns whose type the user declared get only the
19
+ facts the profile needs from them.
12
20
  """
13
21
 
14
22
  from __future__ import annotations
15
23
 
24
+ import math
25
+ from collections.abc import Collection
16
26
  from dataclasses import dataclass, field, replace
17
27
  from typing import Any
18
28
 
@@ -20,6 +30,7 @@ import polars as pl
20
30
 
21
31
  from polars_data_profiling.config import Settings
22
32
  from polars_data_profiling.model import expressions as ex
33
+ from polars_data_profiling.model.engine import chunks
23
34
  from polars_data_profiling.utils.collect import collect
24
35
 
25
36
 
@@ -71,17 +82,59 @@ def _autocorrelation(expr: pl.Expr, lag: int) -> pl.Expr:
71
82
  return pl.corr(expr.filter(complete), lagged.filter(complete))
72
83
 
73
84
 
74
- def _column_facts(
75
- config: Settings, name: str, dtype: pl.DataType
76
- ) -> dict[str, pl.Expr]:
77
- """The fact expressions of one column."""
85
+ def exact_count_bound(config: Settings) -> int:
86
+ """Estimated distinct counts at or below this bound are counted exactly.
87
+
88
+ Inference compares distinct counts with ``vars.num.low_categorical_threshold``
89
+ and ``vars.cat.cardinality_threshold``. The relative error of
90
+ ``approx_n_unique`` is about 1%, so a column estimated above the largest
91
+ threshold plus a 10% margin is above it. Below the bound the count is exact,
92
+ and cheap: the hash set of a low-cardinality column is small.
93
+ """
94
+ threshold = max(
95
+ config.vars.num.low_categorical_threshold,
96
+ config.vars.cat.cardinality_threshold,
97
+ )
98
+ return math.ceil(threshold * 1.1) + 10
99
+
100
+
101
+ def _distinct_counts(name: str, dtype: pl.DataType, exact: bool) -> dict[str, pl.Expr]:
102
+ """Distinct non-null values of a column (and of its parse as numbers)."""
103
+
104
+ def distinct(expr: pl.Expr) -> pl.Expr:
105
+ values = expr.drop_nulls()
106
+ return values.n_unique() if exact else values.approx_n_unique()
107
+
78
108
  col = pl.col(name)
79
- facts: dict[str, pl.Expr] = {"count": col.count()}
109
+ counts: dict[str, pl.Expr] = {}
80
110
  if ex.is_hashable_dtype(dtype) and dtype != pl.Null:
81
- facts["n_unique"] = col.drop_nulls().n_unique()
111
+ counts["n_unique"] = distinct(col)
112
+ if ex.is_string_dtype(dtype):
113
+ counts["num_n_unique"] = distinct(ex.parse_numeric(col))
114
+ return counts
115
+
116
+
117
+ def _declared_facts(name: str, dtype: pl.DataType) -> dict[str, pl.Expr]:
118
+ """The facts of a column whose type the user declared.
119
+
120
+ The declared type replaces inference, so only the non-null count (a column
121
+ without values is inferred all the same) and the memory size are needed.
122
+ """
123
+ col = pl.col(name)
124
+ facts: dict[str, pl.Expr] = {"count": col.count()}
82
125
  size = ex.estimated_size(col, dtype)
83
126
  if size is not None:
84
127
  facts["memory_size"] = size
128
+ return facts
129
+
130
+
131
+ def _column_facts(
132
+ config: Settings, name: str, dtype: pl.DataType
133
+ ) -> dict[str, pl.Expr]:
134
+ """The fact expressions of one column (distinct counts are estimates)."""
135
+ col = pl.col(name)
136
+ facts = _declared_facts(name, dtype)
137
+ facts.update(_distinct_counts(name, dtype, exact=False))
85
138
 
86
139
  timeseries = config.vars.timeseries
87
140
  if ex.is_numeric_dtype(dtype) and timeseries.active:
@@ -99,7 +152,6 @@ def _column_facts(
99
152
  number = ex.parse_numeric(col)
100
153
  facts["num_ok"] = (raw_number.is_not_null() | col.is_null()).all()
101
154
  facts["num_count"] = number.count()
102
- facts["num_n_unique"] = number.drop_nulls().n_unique()
103
155
  if timeseries.active:
104
156
  for lag in timeseries.lags:
105
157
  facts[f"num_autocorr_{lag}"] = _autocorrelation(number, lag)
@@ -125,6 +177,7 @@ def _date_facts(name: str) -> dict[str, pl.Expr]:
125
177
  """Full-column date facts of a string column whose sample parsed as dates.
126
178
 
127
179
  Every non-empty value must parse; empty strings become missing values.
180
+ The distinct count is an estimate: no inference threshold applies to it.
128
181
  """
129
182
  col = pl.col(name)
130
183
  date = ex.parse_datetime(col)
@@ -133,60 +186,103 @@ def _date_facts(name: str) -> dict[str, pl.Expr]:
133
186
  return {
134
187
  "dt_ok": (parsed | col.is_null() | (col.str.strip_chars() == "")).all(),
135
188
  "dt_count": date.count(),
136
- "dt_n_unique": date.drop_nulls().n_unique(),
189
+ "dt_n_unique": date.drop_nulls().approx_n_unique(),
137
190
  "dt_digits": col.filter(parsed).str.contains(r"\d").all(),
138
191
  "dt_plain_numbers": number.filter(parsed).is_not_null().all(),
139
192
  }
140
193
 
141
194
 
142
195
  def _evaluate_facts(
143
- frame: pl.LazyFrame, facts: dict[str, dict[str, pl.Expr]]
196
+ frame: pl.LazyFrame,
197
+ facts: dict[str, dict[str, pl.Expr]],
198
+ max_columns_per_pass: int | None = None,
144
199
  ) -> dict[str, dict[str, Any]]:
145
- """Evaluate the fact expressions of several columns in one select."""
146
- exprs: list[pl.Expr] = []
147
- keys: list[tuple[str, str]] = []
148
- for name, column_facts in facts.items():
149
- for fact, expr in column_facts.items():
150
- keys.append((name, fact))
151
- exprs.append(expr.alias(f"__fact_{len(keys)}"))
200
+ """Evaluate the fact expressions of several columns.
201
+
202
+ The facts of at most ``max_columns_per_pass`` columns go in one select (all
203
+ of them when ``None``). The selects run one after the other, so only the
204
+ aggregation state of one group is held at a time.
205
+ """
152
206
  values: dict[str, dict[str, Any]] = {name: {} for name in facts}
153
- if exprs:
154
- row = collect(frame.select(exprs)).row(0)
155
- for (name, fact), value in zip(keys, row):
156
- values[name][fact] = value
207
+ for group in chunks(list(facts), max_columns_per_pass):
208
+ exprs: list[pl.Expr] = []
209
+ keys: list[tuple[str, str]] = []
210
+ for name in group:
211
+ for fact, expr in facts[name].items():
212
+ keys.append((name, fact))
213
+ exprs.append(expr.alias(f"__fact_{len(keys)}"))
214
+ if exprs:
215
+ row = collect(frame.select(exprs)).row(0)
216
+ for (name, fact), value in zip(keys, row):
217
+ values[name][fact] = value
157
218
  return values
158
219
 
159
220
 
160
221
  def probe_frame(
161
- config: Settings, frame: pl.LazyFrame, schema: pl.Schema | None = None
222
+ config: Settings,
223
+ frame: pl.LazyFrame,
224
+ schema: pl.Schema | None = None,
225
+ declared: Collection[str] = (),
162
226
  ) -> tuple[int, dict[str, InferenceColumn]]:
163
- """Compute the inference facts of every column in one pass.
227
+ """Compute the inference facts of every column.
164
228
 
165
- A second pass computes the date facts of the string columns whose first
166
- values parse as dates (none in most frames).
229
+ The first pass computes every fact, with estimated distinct counts. A second
230
+ pass, over the columns that need it, counts exactly the distinct values of
231
+ the columns estimated at or below :func:`exact_count_bound`, and computes
232
+ the date facts of the string columns whose first values parse as dates.
233
+ Frames whose columns all have many distinct values need no second pass.
167
234
 
168
235
  Args:
169
236
  config: report settings.
170
237
  frame: the preprocessed LazyFrame.
171
238
  schema: its schema, if already known.
239
+ declared: columns whose type the user declared (``type_schema``). They
240
+ get only their count and memory size, unless they have no values:
241
+ the declared type does not apply then, and they are inferred.
172
242
 
173
243
  Returns:
174
244
  The number of rows and an :class:`InferenceColumn` per column.
175
245
  """
176
246
  schema = schema if schema is not None else frame.collect_schema()
247
+ max_columns = config.engine.max_columns_per_pass
177
248
  facts_exprs = {
178
- name: _column_facts(config, name, dtype) for name, dtype in schema.items()
249
+ name: (
250
+ _declared_facts(name, dtype)
251
+ if name in declared
252
+ else _column_facts(config, name, dtype)
253
+ )
254
+ for name, dtype in schema.items()
179
255
  }
180
256
  facts_exprs["__table"] = {"n": pl.len()}
181
- by_column = _evaluate_facts(frame, facts_exprs)
257
+ by_column = _evaluate_facts(frame, facts_exprs, max_columns)
182
258
  n_rows = int(by_column.pop("__table")["n"])
183
259
 
184
- date_candidates = [
185
- name for name, facts in by_column.items() if facts.get("dt_sample_ok")
186
- ]
187
- for name, facts in _evaluate_facts(
188
- frame, {name: _date_facts(name) for name in date_candidates}
189
- ).items():
260
+ bound = exact_count_bound(config)
261
+ second_pass: dict[str, dict[str, pl.Expr]] = {}
262
+ for name, facts in by_column.items():
263
+ dtype = schema[name]
264
+ if name in declared:
265
+ if not facts.get("count"):
266
+ # No values: inferred after all, from the facts inference reads
267
+ second_pass[name] = {
268
+ key: expr
269
+ for key, expr in _column_facts(config, name, dtype).items()
270
+ if key not in facts
271
+ } | _distinct_counts(name, dtype, exact=True)
272
+ continue
273
+ # Exact counts where a threshold may apply: an estimate of 0 is exact,
274
+ # and the numbers parsed from strings count only if all values parse
275
+ exprs = {
276
+ key: expr
277
+ for key, expr in _distinct_counts(name, dtype, exact=True).items()
278
+ if 0 < (facts.get(key) or 0) <= bound
279
+ and (key != "num_n_unique" or facts.get("num_ok"))
280
+ }
281
+ if facts.get("dt_sample_ok"):
282
+ exprs.update(_date_facts(name))
283
+ if exprs:
284
+ second_pass[name] = exprs
285
+ for name, facts in _evaluate_facts(frame, second_pass, max_columns).items():
190
286
  by_column[name].update(facts)
191
287
 
192
288
  columns = {}
@@ -111,10 +111,11 @@ def describe_counts(config: Settings, column: ColumnRef, summary: dict) -> Step:
111
111
  ((count - mean) ** 2 / mean).sum().alias("chi_statistic"),
112
112
  )
113
113
  if orderable:
114
+ # Bounded selections: a sort followed by tail() would sort every
115
+ # distinct value
114
116
  n_extreme = config.n_extreme_obs
115
- ordered = counts.sort(col)
116
- request.frames["first"] = ordered.head(n_extreme)
117
- request.frames["last"] = ordered.tail(n_extreme)
117
+ request.frames["first"] = counts.bottom_k(n_extreme, by=col).sort(col)
118
+ request.frames["last"] = counts.top_k(n_extreme, by=col).sort(col)
118
119
 
119
120
  response = yield request
120
121
  summary["n_missing"] = int(response.values["n_missing"])
@@ -39,9 +39,11 @@ class TypedFrame:
39
39
  def infer_types(
40
40
  config: Settings, df: pl.LazyFrame, typeset: BaseTypeSet
41
41
  ) -> tuple[TypedFrame, dict[str, InferenceColumn]]:
42
- """Infer the type of each column (one lazy pass) and build the typed frame."""
42
+ """Infer the type of each column (one or two lazy passes) and build the
43
+ typed frame. Columns declared in ``type_schema`` are not probed for
44
+ inference."""
43
45
  schema = df.collect_schema()
44
- n_rows, columns = probe_frame(config, df, schema)
46
+ n_rows, columns = probe_frame(config, df, schema, declared=set(typeset.type_schema))
45
47
 
46
48
  types: dict[str, str] = {}
47
49
  exprs: list[pl.Expr] = []
@@ -133,7 +135,12 @@ def get_series_descriptions(
133
135
  def done(_: Any) -> None:
134
136
  pbar.update()
135
137
 
136
- results = run_plans(typed.frame, plans, on_done=done)
138
+ results = run_plans(
139
+ typed.frame,
140
+ plans,
141
+ on_done=done,
142
+ max_plans_per_pass=config.engine.max_columns_per_pass,
143
+ )
137
144
  descriptions = {}
138
145
  for name in typed.types:
139
146
  summary = results.get(name) or summaries[name]
@@ -1,64 +0,0 @@
1
- """Duplicate rows."""
2
-
3
- from __future__ import annotations
4
-
5
- from collections.abc import Sequence
6
- from typing import Any
7
-
8
- import polars as pl
9
-
10
- from polars_data_profiling.config import Settings
11
- from polars_data_profiling.utils.collect import collect_all
12
-
13
-
14
- def get_duplicates(
15
- config: Settings,
16
- df: pl.LazyFrame,
17
- supported_columns: Sequence[str],
18
- n_rows: int,
19
- ) -> tuple[dict[str, Any], pl.DataFrame | None]:
20
- """The most frequent duplicated rows, computed with one lazy group-by.
21
-
22
- Args:
23
- config: report settings.
24
- df: the frame.
25
- supported_columns: the columns that identify a row.
26
- n_rows: number of rows of the frame.
27
-
28
- Returns:
29
- ``n_duplicates`` (the number of distinct rows that occur more than once)
30
- and ``p_duplicates``, and the ``duplicates.head`` most frequent of these
31
- rows with their number of occurrences.
32
- """
33
- n_head = config.duplicates.head
34
- metrics: dict[str, Any] = {}
35
- if n_head <= 0:
36
- return metrics, None
37
- schema = df.collect_schema()
38
- key = config.duplicates.key
39
- if key in schema:
40
- raise ValueError(
41
- f"Duplicates key ({key}) may not be part of the DataFrame. Either change the "
42
- f" column name in the DataFrame or change the 'duplicates.key' parameter."
43
- )
44
- columns = list(supported_columns)
45
- if not columns:
46
- metrics["n_duplicates"] = 0
47
- metrics["p_duplicates"] = 0.0
48
- return metrics, None
49
-
50
- groups = df.group_by(columns).len(name=key).filter(pl.col(key) > 1)
51
- if n_rows == 0:
52
- metrics["n_duplicates"] = 0
53
- metrics["p_duplicates"] = 0.0
54
- return metrics, None
55
- counts, top = collect_all(
56
- [
57
- groups.select(pl.len()),
58
- groups.sort(key, descending=True, maintain_order=True).head(n_head),
59
- ]
60
- )
61
- n_duplicates = counts.item()
62
- metrics["n_duplicates"] = int(n_duplicates)
63
- metrics["p_duplicates"] = n_duplicates / n_rows
64
- return metrics, top