From 53c8d872a2bee1b783858b820a743d59aaae0dd3 Mon Sep 17 00:00:00 2001 From: matanper Date: Thu, 20 Apr 2023 18:04:25 +0300 Subject: [PATCH] fix hide index (#2465) --- deepchecks/core/serialization/common.py | 5 ++++- deepchecks/core/serialization/suite_result/html.py | 5 ++++- deepchecks/core/serialization/suite_result/widget.py | 5 ++++- deepchecks/tabular/checks/model_evaluation/model_info.py | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/deepchecks/core/serialization/common.py b/deepchecks/core/serialization/common.py index 4bb75c790f..b2ed6d3c9d 100644 --- a/deepchecks/core/serialization/common.py +++ b/deepchecks/core/serialization/common.py @@ -185,7 +185,10 @@ def aggregate_conditions( with warnings.catch_warnings(): warnings.simplefilter(action='ignore', category=FutureWarning) - return df.style.hide_index() + # style.hide_index() was deprecated in the latest versions and new method was added + styler = df.style + styler = styler.hide(axis='index') if hasattr(styler, 'hide') else styler.hide_index() + return styler def create_results_dataframe( diff --git a/deepchecks/core/serialization/suite_result/html.py b/deepchecks/core/serialization/suite_result/html.py index 87da0070a8..8239c51b2b 100644 --- a/deepchecks/core/serialization/suite_result/html.py +++ b/deepchecks/core/serialization/suite_result/html.py @@ -348,5 +348,8 @@ def prepare_failures_list(self, **kwargs) -> str: with warnings.catch_warnings(): warnings.simplefilter(action='ignore', category=FutureWarning) - table = DataFrameHtmlSerializer(df.style.hide_index()).serialize() + # style.hide_index() was deprecated in the latest versions and new method was added + styler = df.style + styler = styler.hide(axis='index') if hasattr(styler, 'hide') else styler.hide_index() + table = DataFrameHtmlSerializer(styler).serialize() return f'

Other Checks That Weren\'t Displayed

\n{table}' diff --git a/deepchecks/core/serialization/suite_result/widget.py b/deepchecks/core/serialization/suite_result/widget.py index 73e4376982..d85872b0c6 100644 --- a/deepchecks/core/serialization/suite_result/widget.py +++ b/deepchecks/core/serialization/suite_result/widget.py @@ -305,7 +305,10 @@ def prepare_unconditioned_results_summary( output_id=output_id, is_for_iframe_with_srcdoc=is_for_iframe_with_srcdoc ) - return DataFrameSerializer(df.style.hide_index()).serialize() + # style.hide_index() was deprecated in the latest versions and new method was added + styler = df.style + styler = styler.hide(axis='index') if hasattr(styler, 'hide') else styler.hide_index() + return DataFrameSerializer(styler).serialize() def select_serializer(result): diff --git a/deepchecks/tabular/checks/model_evaluation/model_info.py b/deepchecks/tabular/checks/model_evaluation/model_info.py index 1fd0816125..e3f390cedf 100644 --- a/deepchecks/tabular/checks/model_evaluation/model_info.py +++ b/deepchecks/tabular/checks/model_evaluation/model_info.py @@ -53,7 +53,10 @@ def highlight_not_default(data): return n * [''] with warnings.catch_warnings(): warnings.simplefilter(action='ignore', category=FutureWarning) - model_param_df = model_param_df.style.apply(highlight_not_default, axis=1).hide_index() + model_param_df = model_param_df.style.apply(highlight_not_default, axis=1) + # style.hide_index() was deprecated in the latest versions and new method was added + model_param_df = model_param_df.hide(axis='index') if hasattr(model_param_df, 'hide') \ + else model_param_df.hide_index() value = {'type': model_type, 'params': model_params} footnote = '

Colored rows are parameters with non-default values

'