From c3590338bca41bd57bad68d8888ad3db6de0887a Mon Sep 17 00:00:00 2001 From: Saul Shanabrook Date: Fri, 29 Mar 2024 15:18:09 -0400 Subject: [PATCH] More readable error with unsortable index column Fixes #1567 by raising a better error message pointing out when a column has an unsortable index. --- .../report/structure/variables/render_common.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ydata_profiling/report/structure/variables/render_common.py b/src/ydata_profiling/report/structure/variables/render_common.py index aef8de357..cbd8b6d60 100644 --- a/src/ydata_profiling/report/structure/variables/render_common.py +++ b/src/ydata_profiling/report/structure/variables/render_common.py @@ -9,6 +9,9 @@ def render_common(config: Settings, summary: dict) -> dict: n_extreme_obs = config.n_extreme_obs n_freq_table_max = config.n_freq_table_max + if "value_counts_index_sorted" not in summary: + raise ValueError(f"column {summary['varname']!r} has an unsortable index") + template_variables = { # TODO: with nan "freq_table_rows": freq_table(