From 37f5a03cf9a51c400a96254191aabcb151fca754 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Tue, 24 Oct 2023 18:35:16 +0200 Subject: [PATCH] it was necessary after all --- anndata/_core/anndata.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/anndata/_core/anndata.py b/anndata/_core/anndata.py index f357dcd59..3fc67dd92 100644 --- a/anndata/_core/anndata.py +++ b/anndata/_core/anndata.py @@ -875,9 +875,10 @@ def _prep_dim_index(self, value, attr: str) -> pd.Index: value = pd.Index(value) if not isinstance(value.name, (str, type(None))): value.name = None - if not ( - isinstance(value, pd.RangeIndex) - or infer_dtype(value) in ("string", "bytes") + if ( + len(value) > 0 + and not isinstance(value, pd.RangeIndex) + and infer_dtype(value) not in ("string", "bytes") ): sample = list(value[: min(len(value), 5)]) msg = dedent(