polars-data-profiling 0.2.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.
Files changed (209) hide show
  1. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/PKG-INFO +1 -1
  2. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/pyproject.toml +1 -1
  3. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/pyproject.toml.orig +1 -1
  4. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/config.py +37 -7
  5. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/alerts.py +6 -2
  6. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/correlations.py +46 -12
  7. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/describe.py +7 -3
  8. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/missing.py +20 -13
  9. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/probe.py +44 -21
  10. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/summaries.py +151 -6
  11. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/summary.py +1 -1
  12. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/formatters.py +37 -0
  13. polars_data_profiling-0.3.0/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_high_cardinality.html +1 -0
  14. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_boolean.py +7 -2
  15. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_categorical.py +7 -3
  16. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_complex.py +2 -1
  17. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_count.py +2 -1
  18. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_date.py +7 -2
  19. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_real.py +2 -1
  20. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_text.py +9 -2
  21. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_timeseries.py +2 -1
  22. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_url.py +7 -2
  23. polars_data_profiling-0.3.0/src/polars_data_profiling/utils/memory.py +206 -0
  24. polars_data_profiling-0.2.0/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_high_cardinality.html +0 -1
  25. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/LICENSE +0 -0
  26. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/NOTICE +0 -0
  27. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/README.md +0 -0
  28. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/__init__.py +0 -0
  29. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/compare_reports.py +0 -0
  30. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/config_default.yaml +0 -0
  31. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/config_minimal.yaml +0 -0
  32. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/controller/__init__.py +0 -0
  33. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/controller/console.py +0 -0
  34. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/controller/namespace.py +0 -0
  35. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/__init__.py +0 -0
  36. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/dataframe.py +0 -0
  37. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/description.py +0 -0
  38. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/duplicates.py +0 -0
  39. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/engine.py +0 -0
  40. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/expressions.py +0 -0
  41. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/handler.py +0 -0
  42. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/images.py +0 -0
  43. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/pairwise.py +0 -0
  44. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/sample.py +0 -0
  45. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/summarizer.py +0 -0
  46. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/summary_algorithms.py +0 -0
  47. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/table.py +0 -0
  48. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/timeseries.py +0 -0
  49. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/timeseries_index.py +0 -0
  50. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/type_rules.py +0 -0
  51. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/typeset.py +0 -0
  52. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/typeset_base.py +0 -0
  53. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/model/typeset_relations.py +0 -0
  54. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/profile_report.py +0 -0
  55. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/py.typed +0 -0
  56. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/__init__.py +0 -0
  57. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/__init__.py +0 -0
  58. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/__init__.py +0 -0
  59. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/alerts.py +0 -0
  60. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/collapse.py +0 -0
  61. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/container.py +0 -0
  62. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/correlation_table.py +0 -0
  63. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/dropdown.py +0 -0
  64. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/duplicate.py +0 -0
  65. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/frequency_table.py +0 -0
  66. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/frequency_table_small.py +0 -0
  67. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/html.py +0 -0
  68. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/image.py +0 -0
  69. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/item_renderer.py +0 -0
  70. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/renderable.py +0 -0
  71. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/root.py +0 -0
  72. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/sample.py +0 -0
  73. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/scores.py +0 -0
  74. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/table.py +0 -0
  75. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/toggle_button.py +0 -0
  76. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/variable.py +0 -0
  77. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/core/variable_info.py +0 -0
  78. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/__init__.py +0 -0
  79. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/flavour_html.py +0 -0
  80. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/flavour_widget.py +0 -0
  81. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/flavours.py +0 -0
  82. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/__init__.py +0 -0
  83. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/alerts.py +0 -0
  84. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/collapse.py +0 -0
  85. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/container.py +0 -0
  86. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/correlation_table.py +0 -0
  87. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/dropdown.py +0 -0
  88. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/duplicate.py +0 -0
  89. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/frame_table.py +0 -0
  90. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/frequency_table.py +0 -0
  91. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/frequency_table_small.py +0 -0
  92. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/html.py +0 -0
  93. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/image.py +0 -0
  94. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/root.py +0 -0
  95. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/sample.py +0 -0
  96. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/scores.py +0 -0
  97. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/table.py +0 -0
  98. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_constant.html +0 -0
  99. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_constant_length.html +0 -0
  100. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_dirty_category.html +0 -0
  101. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_duplicates.html +0 -0
  102. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_empty.html +0 -0
  103. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_high_correlation.html +0 -0
  104. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_imbalance.html +0 -0
  105. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_infinite.html +0 -0
  106. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_missing.html +0 -0
  107. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_near_duplicates.html +0 -0
  108. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_non_stationary.html +0 -0
  109. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_seasonal.html +0 -0
  110. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_skewed.html +0 -0
  111. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_truncated.html +0 -0
  112. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_type_date.html +0 -0
  113. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_uniform.html +0 -0
  114. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_unique.html +0 -0
  115. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_unsupported.html +0 -0
  116. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts/alert_zeros.html +0 -0
  117. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/alerts.html +0 -0
  118. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/collapse.html +0 -0
  119. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/correlation_table.html +0 -0
  120. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/diagram.html +0 -0
  121. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/dropdown.html +0 -0
  122. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/duplicate.html +0 -0
  123. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/frequency_table.html +0 -0
  124. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/frequency_table_small.html +0 -0
  125. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/report.html +0 -0
  126. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sample.html +0 -0
  127. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/scores.html +0 -0
  128. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/batch_grid.html +0 -0
  129. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/cards.html +0 -0
  130. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/correlations.html +0 -0
  131. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/grid.html +0 -0
  132. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/interactions.html +0 -0
  133. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/list.html +0 -0
  134. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/named_list.html +0 -0
  135. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/overview_tabs.html +0 -0
  136. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/scores.html +0 -0
  137. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/sections.html +0 -0
  138. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/select.html +0 -0
  139. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/sequence/tabs.html +0 -0
  140. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/table.html +0 -0
  141. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/toggle_button.html +0 -0
  142. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/variable.html +0 -0
  143. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/variable_info.html +0 -0
  144. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/bootstrap.bundle.min.js +0 -0
  145. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/bootstrap.min.css +0 -0
  146. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/cosmo.bootstrap.min.css +0 -0
  147. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/flatly.bootstrap.min.css +0 -0
  148. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/script.js +0 -0
  149. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/simplex.bootstrap.min.css +0 -0
  150. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/style.css +0 -0
  151. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/assets/united.bootstrap.min.css +0 -0
  152. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/footer.html +0 -0
  153. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/javascript.html +0 -0
  154. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/navigation.html +0 -0
  155. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates/wrapper/style.html +0 -0
  156. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/templates.py +0 -0
  157. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/theme.py +0 -0
  158. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/toggle_button.py +0 -0
  159. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/variable.py +0 -0
  160. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/html/variable_info.py +0 -0
  161. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/__init__.py +0 -0
  162. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/alerts.py +0 -0
  163. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/collapse.py +0 -0
  164. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/container.py +0 -0
  165. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/correlation_table.py +0 -0
  166. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/dropdown.py +0 -0
  167. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/duplicate.py +0 -0
  168. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/frequency_table.py +0 -0
  169. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/frequency_table_small.py +0 -0
  170. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/html.py +0 -0
  171. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/image.py +0 -0
  172. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/notebook.py +0 -0
  173. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/root.py +0 -0
  174. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/sample.py +0 -0
  175. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/table.py +0 -0
  176. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/toggle_button.py +0 -0
  177. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/variable.py +0 -0
  178. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/flavours/widget/variable_info.py +0 -0
  179. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/presentation/frequency_table_utils.py +0 -0
  180. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/__init__.py +0 -0
  181. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/correlations.py +0 -0
  182. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/overview.py +0 -0
  183. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/report.py +0 -0
  184. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/__init__.py +0 -0
  185. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_common.py +0 -0
  186. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_file.py +0 -0
  187. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_generic.py +0 -0
  188. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_image.py +0 -0
  189. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/structure/variables/render_path.py +0 -0
  190. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/report/utils.py +0 -0
  191. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/serialize_report.py +0 -0
  192. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/__init__.py +0 -0
  193. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/collect.py +0 -0
  194. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/common.py +0 -0
  195. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/dataframe.py +0 -0
  196. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/notebook.py +0 -0
  197. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/paths.py +0 -0
  198. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/progress_bar.py +0 -0
  199. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/utils/styles.py +0 -0
  200. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/version.py +0 -0
  201. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/__init__.py +0 -0
  202. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/charts/__init__.py +0 -0
  203. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/charts/builders.py +0 -0
  204. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/charts/palette.py +0 -0
  205. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/charts/scales.py +0 -0
  206. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/charts/specs.py +0 -0
  207. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/charts/svg.py +0 -0
  208. {polars_data_profiling-0.2.0 → polars_data_profiling-0.3.0}/src/polars_data_profiling/visualisation/missing.py +0 -0
  209. {polars_data_profiling-0.2.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.2.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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "polars-data-profiling"
3
- version = "0.2.0"
3
+ version = "0.3.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.2.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"
@@ -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):
@@ -374,13 +383,34 @@ class Engine(BaseModel):
374
383
  # which lowers peak memory on very large Parquet files at the cost of more
375
384
  # reads.
376
385
  share_scans: bool = True
377
- # Polars engine used to collect: "auto", "in-memory", "streaming" or "gpu"
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
378
395
  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
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"
384
414
 
385
415
 
386
416
  class Report(BaseModel):
@@ -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
- return f"[{self.column_name}] has {self.values['n_distinct']:} ({fmt_percent(self.values['p_distinct'])}) distinct values"
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
- if summary.get("n_distinct", np.nan) == summary["n"]:
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(df: pl.LazyFrame, column: str, n_bins: int) -> pl.Expr:
200
- """Equal-width bins over [min, max], labelled 0..n_bins-1 (as pd.cut)."""
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, high = x.min(), x.max()
203
- width = (high - low) / n_bins
204
- return (
205
- pl.when(width > 0)
206
- .then(((x - low) / width).floor().clip(0, n_bins - 1))
207
- .otherwise(0)
208
- .cast(pl.Int64)
209
- .alias(column)
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(df, c, n_bins) for c in numeric]
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, df, summarizer, typeset, sample)
71
+ return _describe(config, lf, summarizer, typeset, sample)
68
72
 
69
73
 
70
74
  def _describe(
71
75
  config: Settings,
72
- df: pl.LazyFrame | pl.DataFrame,
76
+ df: pl.LazyFrame,
73
77
  summarizer: BaseSummarizer,
74
78
  typeset: BaseTypeSet,
75
79
  sample: dict | None,
76
80
  ) -> BaseDescription:
77
- lf = preprocess(config, to_lazyframe(df))
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()
@@ -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 shares
40
- are computed with one lazy group-by, so only a small matrix is collected.
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.int_range(pl.len(), dtype=pl.Int64) * n_bands // max(n_rows, 1)).alias(
45
- "__band"
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
- fractions[bands] = shares.select(columns).to_numpy()
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
 
@@ -21,7 +21,6 @@ facts the profile needs from them.
21
21
 
22
22
  from __future__ import annotations
23
23
 
24
- import math
25
24
  from collections.abc import Collection
26
25
  from dataclasses import dataclass, field, replace
27
26
  from typing import Any
@@ -86,24 +85,30 @@ def exact_count_bound(config: Settings) -> int:
86
85
  """Estimated distinct counts at or below this bound are counted exactly.
87
86
 
88
87
  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.
88
+ and ``vars.cat.cardinality_threshold``. A column is taken to be above them
89
+ when its estimate exceeds twice the largest threshold plus 10 (110 with the
90
+ defaults), so only an overestimate of more than 100% can misclassify one.
91
+ The relative error of ``approx_n_unique`` is under 1% on the in-memory
92
+ engine, but about 6.5% (RMS, up to 19% in 300 trials) on the streaming
93
+ engine of polars 2.2 (#17). Below the bound the count is exact, and cheap:
94
+ the hash set of a low-cardinality column is small.
93
95
  """
94
96
  threshold = max(
95
97
  config.vars.num.low_categorical_threshold,
96
98
  config.vars.cat.cardinality_threshold,
97
99
  )
98
- return math.ceil(threshold * 1.1) + 10
100
+ return 2 * threshold + 10
99
101
 
100
102
 
101
103
  def _distinct_counts(name: str, dtype: pl.DataType, exact: bool) -> dict[str, pl.Expr]:
102
104
  """Distinct non-null values of a column (and of its parse as numbers)."""
103
105
 
104
106
  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
+ # Both count null as a value. Subtracting it, rather than dropping the
108
+ # nulls first, keeps every fact the length of the frame (see
109
+ # _evaluate_facts).
110
+ count = expr.n_unique() if exact else expr.approx_n_unique()
111
+ return count - expr.null_count().gt(0).cast(pl.UInt32)
107
112
 
108
113
  col = pl.col(name)
109
114
  counts: dict[str, pl.Expr] = {}
@@ -183,37 +188,53 @@ def _date_facts(name: str) -> dict[str, pl.Expr]:
183
188
  date = ex.parse_datetime(col)
184
189
  parsed = date.is_not_null()
185
190
  number = ex.parse_numeric(col)
191
+ # "All parsed values ..." is written without a filter, keeping the length
186
192
  return {
187
193
  "dt_ok": (parsed | col.is_null() | (col.str.strip_chars() == "")).all(),
188
194
  "dt_count": date.count(),
189
- "dt_n_unique": date.drop_nulls().approx_n_unique(),
190
- "dt_digits": col.filter(parsed).str.contains(r"\d").all(),
191
- "dt_plain_numbers": number.filter(parsed).is_not_null().all(),
195
+ "dt_n_unique": date.approx_n_unique() - date.null_count().gt(0).cast(pl.UInt32),
196
+ "dt_digits": (~parsed | col.str.contains(r"\d")).all(),
197
+ "dt_plain_numbers": (~parsed | number.is_not_null()).all(),
192
198
  }
193
199
 
194
200
 
201
+ def _changes_length(fact: str) -> bool:
202
+ """Whether a fact's expression filters or slices its column.
203
+
204
+ On the streaming engine, a select that mixes such expressions with plain
205
+ reductions buffers its input in proportion to the rows read.
206
+ """
207
+ return fact == "dt_sample_ok" or "autocorr_" in fact
208
+
209
+
195
210
  def _evaluate_facts(
196
211
  frame: pl.LazyFrame,
197
212
  facts: dict[str, dict[str, pl.Expr]],
198
213
  max_columns_per_pass: int | None = None,
214
+ separate_length_changing: bool = False,
199
215
  ) -> dict[str, dict[str, Any]]:
200
216
  """Evaluate the fact expressions of several columns.
201
217
 
202
218
  The facts of at most ``max_columns_per_pass`` columns go in one select (all
203
219
  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.
220
+ aggregation state of one group is held at a time. With
221
+ ``separate_length_changing``, the facts that filter or slice their column
222
+ (see :func:`_changes_length`) get a select of their own in each group:
223
+ slower, but the streaming engine then does not buffer the input.
205
224
  """
206
225
  values: dict[str, dict[str, Any]] = {name: {} for name in facts}
207
226
  for group in chunks(list(facts), max_columns_per_pass):
208
- exprs: list[pl.Expr] = []
209
- keys: list[tuple[str, str]] = []
227
+ selects: dict[bool, list[tuple[str, str, pl.Expr]]] = {False: [], True: []}
210
228
  for name in group:
211
229
  for fact, expr in facts[name].items():
212
- keys.append((name, fact))
213
- exprs.append(expr.alias(f"__fact_{len(keys)}"))
214
- if exprs:
230
+ separate = separate_length_changing and _changes_length(fact)
231
+ selects[separate].append((name, fact, expr))
232
+ for items in selects.values():
233
+ if not items:
234
+ continue
235
+ exprs = [expr.alias(f"__fact_{i}") for i, (*_, expr) in enumerate(items)]
215
236
  row = collect(frame.select(exprs)).row(0)
216
- for (name, fact), value in zip(keys, row):
237
+ for (name, fact, _), value in zip(items, row):
217
238
  values[name][fact] = value
218
239
  return values
219
240
 
@@ -244,7 +265,8 @@ def probe_frame(
244
265
  The number of rows and an :class:`InferenceColumn` per column.
245
266
  """
246
267
  schema = schema if schema is not None else frame.collect_schema()
247
- max_columns = config.engine.max_columns_per_pass
268
+ max_columns = config.engine.columns_per_pass
269
+ separate = config.engine.low_memory
248
270
  facts_exprs = {
249
271
  name: (
250
272
  _declared_facts(name, dtype)
@@ -254,7 +276,7 @@ def probe_frame(
254
276
  for name, dtype in schema.items()
255
277
  }
256
278
  facts_exprs["__table"] = {"n": pl.len()}
257
- by_column = _evaluate_facts(frame, facts_exprs, max_columns)
279
+ by_column = _evaluate_facts(frame, facts_exprs, max_columns, separate)
258
280
  n_rows = int(by_column.pop("__table")["n"])
259
281
 
260
282
  bound = exact_count_bound(config)
@@ -282,7 +304,8 @@ def probe_frame(
282
304
  exprs.update(_date_facts(name))
283
305
  if exprs:
284
306
  second_pass[name] = exprs
285
- for name, facts in _evaluate_facts(frame, second_pass, max_columns).items():
307
+ second = _evaluate_facts(frame, second_pass, max_columns, separate)
308
+ for name, facts in second.items():
286
309
  by_column[name].update(facts)
287
310
 
288
311
  columns = {}
@@ -25,6 +25,7 @@ import polars as pl
25
25
  from polars_data_profiling.config import Settings
26
26
  from polars_data_profiling.model import expressions as ex
27
27
  from polars_data_profiling.model.engine import ColumnRef, Request, Response
28
+ from polars_data_profiling.model.probe import exact_count_bound
28
29
  from polars_data_profiling.model.summary_algorithms import (
29
30
  ValueCounts,
30
31
  bin_counts,
@@ -84,11 +85,97 @@ def top_counts(lf: pl.LazyFrame, expr: pl.Expr, k: int) -> pl.LazyFrame:
84
85
  # ---------------------------------------------------------------------------
85
86
 
86
87
 
88
+ def _skips_value_counts(
89
+ config: Settings, n_missing: int, estimate: int, n: int
90
+ ) -> bool:
91
+ """Whether a column is near-unique enough to skip its exact value counts.
92
+
93
+ Columns at or below inference's exact count bound are always counted, so
94
+ small columns and those near a type threshold keep exact counts.
95
+ """
96
+ ratio = config.vars.value_counts_max_distinct_ratio
97
+ count = n - n_missing
98
+ return (
99
+ config.vars.distinct_count == "approximate"
100
+ and count > 0
101
+ and estimate > exact_count_bound(config)
102
+ and estimate > ratio * count
103
+ )
104
+
105
+
106
+ # Distinct hashes counted exactly to estimate the distinct count of a column
107
+ # whose value counts are skipped: the relative error is about 1/sqrt(this).
108
+ HASH_SAMPLE = 1 << 16
109
+
110
+
111
+ def sampled_distinct(lf: pl.LazyFrame, expr: pl.Expr, rough: int) -> pl.LazyFrame:
112
+ """Count the distinct non-null values of ``expr`` through their hashes.
113
+
114
+ A column estimated (``rough``) at up to ``HASH_SAMPLE`` distinct values gets
115
+ all its hashes counted, which is exact: two of 65,536 64-bit hashes collide
116
+ with a probability of about 1e-10. Above that, the values whose hash falls
117
+ in the lowest ``HASH_SAMPLE / rough`` of the hash range are counted, and the
118
+ count is scaled up: about 0.5% off, whatever the engine, against several
119
+ percent for ``approx_n_unique`` on the streaming engine (#17). Either way
120
+ only about ``HASH_SAMPLE`` hashes are held in memory. The filter changes the
121
+ length of the column, so this is a query of its own, not an aggregation
122
+ shared with others.
123
+
124
+ Returns:
125
+ A one-row frame: the count in ``n_distinct`` and whether it is exact in
126
+ ``exact``.
127
+ """
128
+ hashes = expr.drop_nulls().hash(seed=0)
129
+ if rough <= HASH_SAMPLE:
130
+ return lf.select(
131
+ hashes.n_unique().cast(pl.Float64).alias("n_distinct"),
132
+ pl.lit(True).alias("exact"),
133
+ )
134
+ fraction = HASH_SAMPLE / rough
135
+ cutoff = pl.lit(min(int(fraction * 2**64), 2**64 - 1), dtype=pl.UInt64)
136
+ kept = hashes.filter(hashes < cutoff).n_unique()
137
+ return lf.select(
138
+ (kept.cast(pl.Float64) / fraction).round().alias("n_distinct"),
139
+ pl.lit(False).alias("exact"),
140
+ )
141
+
142
+
87
143
  def describe_counts(config: Settings, column: ColumnRef, summary: dict) -> Step:
88
- """Missing values, distinct values and the value counts."""
144
+ """Missing values, distinct values and the value counts.
145
+
146
+ With ``vars.distinct_count="approximate"``, a first round estimates the
147
+ distinct count (``approx_n_unique``), and near-unique columns skip the
148
+ group-by of their values, which holds every distinct value (see
149
+ :func:`_skips_value_counts`). Their distinct count then comes from
150
+ :func:`sampled_distinct`, in the round the group-by would have taken.
151
+ """
89
152
  hashable = ex.is_hashable_dtype(column.dtype) and column.dtype != pl.Null
90
153
  summary["hashable"] = hashable
91
154
  request = Request(aggs={"n_missing": column.expr.null_count()})
155
+ if hashable and config.vars.distinct_count == "approximate":
156
+ expr = column.expr
157
+ response = yield Request(
158
+ aggs={
159
+ "n_missing": expr.null_count(),
160
+ "estimate": expr.approx_n_unique()
161
+ - expr.null_count().gt(0).cast(pl.UInt32),
162
+ }
163
+ )
164
+ n_missing = int(response.values["n_missing"])
165
+ rough = int(response.values["estimate"])
166
+ if _skips_value_counts(config, n_missing, rough, summary["n"]):
167
+ response = yield Request(
168
+ frames={"distinct": sampled_distinct(column.frame, expr, rough)}
169
+ )
170
+ distinct = response.frames["distinct"].row(0, named=True)
171
+ count = summary["n"] - n_missing
172
+ _skip_value_counts(
173
+ summary,
174
+ n_missing,
175
+ min(int(distinct["n_distinct"]), count),
176
+ exact=bool(distinct["exact"]),
177
+ )
178
+ return
92
179
  if hashable:
93
180
  col = column.name
94
181
  counts = (
@@ -140,6 +227,31 @@ def describe_counts(config: Settings, column: ColumnRef, summary: dict) -> Step:
140
227
  summary["ordering"] = False
141
228
 
142
229
 
230
+ def _skip_value_counts(
231
+ summary: dict, n_missing: int, n_distinct: int, exact: bool
232
+ ) -> None:
233
+ """The count entries of a column whose value counts are skipped.
234
+
235
+ The values that occur once are only known when the distinct count is exact
236
+ and equals the number of values: then every value occurs once.
237
+ """
238
+ count = summary["n"] - n_missing
239
+ summary.update(
240
+ {
241
+ "n_missing": n_missing,
242
+ "n_distinct": n_distinct,
243
+ "n_distinct_estimated": not exact,
244
+ "value_counts_skipped": True,
245
+ "n_unique": count if exact and n_distinct == count else None,
246
+ "_entropy": None,
247
+ "_counts_chi_statistic": None,
248
+ "value_counts_without_nan": ValueCounts(),
249
+ "value_counts_index_sorted": ValueCounts(),
250
+ "ordering": False,
251
+ }
252
+ )
253
+
254
+
143
255
  def describe_generic(config: Settings, column: ColumnRef, summary: dict) -> None:
144
256
  """Number of values and the share of missing values."""
145
257
  n = summary["n"]
@@ -155,6 +267,17 @@ def describe_supported(config: Settings, column: ColumnRef, summary: dict) -> No
155
267
  count = summary["count"]
156
268
  distinct = summary["n_distinct"]
157
269
  unique = summary["n_unique"]
270
+ if unique is None:
271
+ # Value counts skipped, and the values that occur once unknown (see
272
+ # _skip_value_counts): not every value is known to be unique
273
+ summary.update(
274
+ {
275
+ "p_distinct": min(distinct / count, 1.0) if count > 0 else 0,
276
+ "is_unique": False,
277
+ "p_unique": None,
278
+ }
279
+ )
280
+ return
158
281
  summary.update(
159
282
  {
160
283
  "p_distinct": distinct / count if count > 0 else 0,
@@ -277,6 +400,11 @@ def describe_numeric(config: Settings, column: ColumnRef, summary: dict) -> Step
277
400
  "monotonic_decrease": raw.diff().drop_nulls().le(0).all(),
278
401
  **_finite_aggs(x),
279
402
  }
403
+ estimated = summary.get("n_distinct_estimated", False)
404
+ if estimated:
405
+ # Strictly monotonic without an exact distinct count
406
+ aggs["strict_increase"] = raw.diff().drop_nulls().gt(0).all()
407
+ aggs["strict_decrease"] = raw.diff().drop_nulls().lt(0).all()
280
408
  for q in quantiles:
281
409
  aggs[f"q_{q}"] = x.quantile(q, "linear")
282
410
 
@@ -319,13 +447,17 @@ def describe_numeric(config: Settings, column: ColumnRef, summary: dict) -> Step
319
447
  summary["iqr"] = summary["75%"] - summary["25%"]
320
448
  summary["cv"] = summary["std"] / summary["mean"] if summary["mean"] else np.nan
321
449
 
322
- is_unique = summary.get("n_distinct") == count
323
450
  increase = bool(v["monotonic_increase"])
324
451
  decrease = bool(v["monotonic_decrease"])
325
452
  summary["monotonic_increase"] = increase
326
453
  summary["monotonic_decrease"] = decrease
327
- summary["monotonic_increase_strict"] = increase and is_unique
328
- summary["monotonic_decrease_strict"] = decrease and is_unique
454
+ if estimated:
455
+ summary["monotonic_increase_strict"] = bool(v["strict_increase"])
456
+ summary["monotonic_decrease_strict"] = bool(v["strict_decrease"])
457
+ else:
458
+ is_unique = summary.get("n_distinct") == count
459
+ summary["monotonic_increase_strict"] = increase and is_unique
460
+ summary["monotonic_decrease_strict"] = decrease and is_unique
329
461
  if summary["monotonic_increase_strict"]:
330
462
  summary["monotonic"] = 2
331
463
  elif summary["monotonic_decrease_strict"]:
@@ -487,20 +619,33 @@ def describe_categorical(config: Settings, column: ColumnRef, summary: dict) ->
487
619
  "pvalue": float(chi2.sf(statistic, dof)) if dof > 0 else float("nan"),
488
620
  }
489
621
  response = yield _string_requests(
490
- config, column, cat.length, cat.characters, cat.words
622
+ config, column, cat.length, cat.characters, _words(cat.words, summary)
491
623
  )
492
624
  if not cat.redact:
493
625
  summary["first_rows"] = response.frames["first_rows"].get_column("v")
494
626
  _string_results(config, response, summary)
495
627
 
496
628
 
629
+ def _words(enabled: bool, summary: dict) -> bool:
630
+ """Whether to count the words of a column.
631
+
632
+ Not for a column whose value counts were skipped: its words are mostly as
633
+ distinct as its values, so their counts would hold as much memory as the
634
+ value counts. The column is flagged ``word_counts_skipped`` instead.
635
+ """
636
+ if enabled and summary.get("value_counts_skipped"):
637
+ summary["word_counts_skipped"] = True
638
+ return False
639
+ return enabled
640
+
641
+
497
642
  def describe_text(config: Settings, column: ColumnRef, summary: dict) -> Step:
498
643
  """Length, character and word statistics of free text."""
499
644
  if not summary.get("hashable"):
500
645
  return
501
646
  text = config.vars.text
502
647
  response = yield _string_requests(
503
- config, column, text.length, text.characters, text.words
648
+ config, column, text.length, text.characters, _words(text.words, summary)
504
649
  )
505
650
  summary["first_rows"] = response.frames["first_rows"].get_column("v")
506
651
  _string_results(config, response, summary)
@@ -139,7 +139,7 @@ def get_series_descriptions(
139
139
  typed.frame,
140
140
  plans,
141
141
  on_done=done,
142
- max_plans_per_pass=config.engine.max_columns_per_pass,
142
+ max_plans_per_pass=config.engine.columns_per_pass,
143
143
  )
144
144
  descriptions = {}
145
145
  for name in typed.types: