Skip to content

Fix FutureWarning for na_action in Categorical.map#541

Closed
timtreis wants to merge 1 commit intomainfrom
fix/categorical-map-na-action-warning
Closed

Fix FutureWarning for na_action in Categorical.map#541
timtreis wants to merge 1 commit intomainfrom
fix/categorical-map-na-action-warning

Conversation

@timtreis
Copy link
Member

@timtreis timtreis commented Mar 5, 2026

Summary

  • Fixes the FutureWarning from pandas ≥2.1 about the deprecated default na_action parameter in Categorical.map() by explicitly passing na_action="ignore"
  • The mapper is always a dict (never a callable), so na_action has no effect on behavior — this is a pure warning suppression with zero functional change

Closes #540

Test plan

  • Existing tests pass (no behavioral change)
  • Verify warning is no longer emitted with pandas ≥2.1

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.96%. Comparing base (c538e7f) to head (c13b92f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #541   +/-   ##
=======================================
  Coverage   83.96%   83.96%           
=======================================
  Files           9        9           
  Lines        2595     2595           
=======================================
  Hits         2179     2179           
  Misses        416      416           
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/utils.py 79.30% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis closed this Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FutureWarning: The default value of 'ignore' for the na_action parameter in pandas.Categorical.map is deprecated

2 participants