From c13b92f64e11773badb4d08360d9cc3701dfe2ad Mon Sep 17 00:00:00 2001 From: Tim Treis Date: Thu, 5 Mar 2026 17:13:22 +0100 Subject: [PATCH] Fix FutureWarning for na_action in Categorical.map Explicitly pass `na_action="ignore"` to `Categorical.map()` to silence the FutureWarning introduced in pandas 2.1. This preserves the existing behavior with no functional change, as the mapper is always a dict. Closes #540 Co-Authored-By: Claude Opus 4.6 --- src/spatialdata_plot/pl/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spatialdata_plot/pl/utils.py b/src/spatialdata_plot/pl/utils.py index 9d3b2954..59045022 100644 --- a/src/spatialdata_plot/pl/utils.py +++ b/src/spatialdata_plot/pl/utils.py @@ -1120,7 +1120,7 @@ def _set_color_source_vec( raise ValueError("Unable to create color palette.") # do not rename categories, as colors need not be unique - color_vector = color_source_vector.map(color_mapping) + color_vector = color_source_vector.map(color_mapping, na_action="ignore") return color_source_vector, color_vector, True