Skip to content

Commit

Permalink
fix hide index (#2465)
Browse files Browse the repository at this point in the history
  • Loading branch information
matanper committed Apr 20, 2023
1 parent ca57913 commit 53c8d87
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion deepchecks/core/serialization/common.py
Expand Up @@ -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(
Expand Down
5 changes: 4 additions & 1 deletion deepchecks/core/serialization/suite_result/html.py
Expand Up @@ -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'<h2>Other Checks That Weren\'t Displayed</h2>\n{table}'
5 changes: 4 additions & 1 deletion deepchecks/core/serialization/suite_result/widget.py
Expand Up @@ -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):
Expand Down
5 changes: 4 additions & 1 deletion deepchecks/tabular/checks/model_evaluation/model_info.py
Expand Up @@ -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 = '<p style="font-size:0.7em"><i>Colored rows are parameters with non-default values</i></p>'
Expand Down

0 comments on commit 53c8d87

Please sign in to comment.