Skip to content

Commit

Permalink
it was necessary after all
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed Oct 24, 2023
1 parent 4a0792d commit 37f5a03
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions anndata/_core/anndata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 37f5a03

Please sign in to comment.