From 1476faca35dc59a02b6fd6b46792e422058c7003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Fri, 19 Apr 2024 13:59:27 +0200 Subject: [PATCH] Wrap inside of except --- holoviews/core/data/pandas.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/holoviews/core/data/pandas.py b/holoviews/core/data/pandas.py index b97535d35e..2292e084b7 100644 --- a/holoviews/core/data/pandas.py +++ b/holoviews/core/data/pandas.py @@ -361,9 +361,9 @@ def sorted_index(cls, df): def sort_depth(cls, df): try: from pandas.core.indexes.multi import _lexsort_depth - except Exception: + return _lexsort_depth(df.index.codes, df.index.nlevels) + except (ImportError, AttributeError): return 0 - return _lexsort_depth(df.index.codes, df.index.nlevels) @classmethod def index_selection(cls, df, selection):