From 2a2617ba04badcf6933f74892f00f2d032d132fb Mon Sep 17 00:00:00 2001 From: Philipp A Date: Fri, 3 Nov 2023 14:16:06 +0100 Subject: [PATCH] Fix na_action compatibility --- anndata/compat/__init__.py | 4 ++-- docs/release-notes/0.10.4.md | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/anndata/compat/__init__.py b/anndata/compat/__init__.py index a0a77977f..24f3875b3 100644 --- a/anndata/compat/__init__.py +++ b/anndata/compat/__init__.py @@ -395,8 +395,8 @@ def _safe_transpose(x): def _map_cat_to_str(cat: pd.Categorical) -> pd.Categorical: - if Version(pd.__version__) >= Version("2.0"): - # Argument added in pandas 2.0 + if Version(pd.__version__) >= Version("2.1"): + # Argument added in pandas 2.1 return cat.map(str, na_action="ignore") else: return cat.map(str) diff --git a/docs/release-notes/0.10.4.md b/docs/release-notes/0.10.4.md index 0f628d3d0..0941f91fd 100644 --- a/docs/release-notes/0.10.4.md +++ b/docs/release-notes/0.10.4.md @@ -2,6 +2,7 @@ ```{rubric} Bugfix ``` +* Only try to use `Categorical.map(na_action=…)` in actually supported Pandas ≥2.1 {pr}`1226` {user}`flying-sheep` ```{rubric} Documentation ```