Skip to content

fix: pandas compat in impute.py, update CI runners and Python versions#159

Merged
Secbone merged 4 commits into
masterfrom
fix/ci-pandas-compat-and-macos-runner
Apr 13, 2026
Merged

fix: pandas compat in impute.py, update CI runners and Python versions#159
Secbone merged 4 commits into
masterfrom
fix/ci-pandas-compat-and-macos-runner

Conversation

@Secbone

@Secbone Secbone commented Apr 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Fix toad/impute.py chained assignment (X[col].loc[~mask]) that breaks with pandas Copy-on-Write (pandas >= 2.x), replacing with proper .loc indexing
  • Convert string columns to object dtype before processing to avoid StringDtype incompatibility with newer pandas
  • Replace deprecated macos-13 runner with macos-14 in CI workflow
  • Promote Python 3.13 from experimental to stable across all CI platforms
  • Add Python 3.14 as experimental across all platforms (Linux, macOS, Windows)

Root Cause

The test_impute_with_str test failed on Python 3.11/3.12/3.13 because newer pandas enforces Copy-on-Write and stricter string dtype handling. The chained assignment pattern X[col].loc[~mask[col]] = value is no longer supported.

Test plan

  • All existing tests pass on Python 3.9-3.13 (Linux, macOS, Windows)
  • test_impute_with_str specifically passes on Python 3.11+
  • macOS CI runs successfully with macos-14 runner
  • Python 3.14 experimental jobs run (allowed to fail)

🤖 Generated with Claude Code

Secbone and others added 4 commits April 13, 2026 20:16
- Fix chained assignment in impute.py _fit_encode/_encode to use .loc
  indexing instead of X[col].loc[] which breaks pandas Copy-on-Write
- Convert string columns to object dtype before processing to avoid
  StringDtype incompatibility with newer pandas
- Replace deprecated macos-13 runner with macos-14
- Promote Python 3.13 from experimental to stable in CI matrix
- Add Python 3.14 as experimental across all platforms

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace `F(len)(A)[0]` with `F(len)(A).iloc[0]` to fix KeyError on
pandas 3.x where string-indexed Series no longer accept integer keys.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
In pandas 3.x, Index.values returns StringArray instead of numpy array.
Using .tolist() ensures str() gives the expected list format `['A']`
instead of `<StringArray>` in the duplicate keys error message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
DataFrame.applymap was removed in pandas 3.0. Use DataFrame.map instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Secbone Secbone merged commit 72f3fbc into master Apr 13, 2026
50 checks passed
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.

1 participant