Skip to content

Fix compatibility with Pandas > 3.0#535

Merged
leouieda merged 7 commits intofatiando:mainfrom
Gabriel-Goes:fix-530-sklearn-1-8-scoring
Mar 16, 2026
Merged

Fix compatibility with Pandas > 3.0#535
leouieda merged 7 commits intofatiando:mainfrom
Gabriel-Goes:fix-530-sklearn-1-8-scoring

Conversation

@Gabriel-Goes
Copy link
Contributor

@Gabriel-Goes Gabriel-Goes commented Mar 11, 2026

Update 2026-03-16: Reworked to fix only the Pandas 3 compatibility issues.

Fixes #536


This updates DummyEstimator so Verde scoring works again with scikit-learn>=1.8, which now checks estimator tags during scoring.

Compared to #531, this keeps the same root fix but also:

  • passes an estimator instance to check_scoring
  • marks DummyEstimator as a regressor via RegressorMixin, BaseEstimator
  • adds a regression test for the BaseGridder.score path shown in the issue traceback

Temporary dependency note:

Validation run locally:

  • pytest verde/tests/test_model_selection.py -q -k "not client"
  • selected .score(...) tests in test_vector.py and test_chain.py
  • a lightweight vd.Spline() + vd.cross_val_score(...) repro under scikit-learn 1.8.0
  • a 2x2 Python 3.12 matrix showing the new failures only with pandas 3.0.1

I did not use the legacy client test as acceptance criteria because it hangs in the temporary validation environment and appears unrelated to this bugfix.

Make DummyEstimator a valid scikit-learn regressor so cross-validation no longer fails on scikit-learn>=1.8. Also pass an estimator instance to check_scoring and add a regression test for the BaseGridder.score path.
@Gabriel-Goes
Copy link
Contributor Author

The new CI failures in this PR turned out to be separate from the #530 scoring fix.

I ran a small Python 3.12 version matrix and the failures reproduced whenever pandas==3.0.1 was present, regardless of whether NumPy was 2.4.0 or 2.4.2. The same targeted checks passed with pandas==2.3.3, including numpy==2.4.2.

To keep #535 focused on #530 and unblock review of the scoring fix, I pushed a temporary pandas<3 upper bound in 7b80173. The follow-up compatibility bug is now tracked separately in #536.

Once #536 is fixed, this temporary pin can be removed.

@Gabriel-Goes
Copy link
Contributor Author

The follow-up pandas compatibility work is now in this PR directly.

Since the temporary pandas<3 workaround, I backported the real #536 fix into this branch in eb45c23 and then removed the pin in ca2f1a7.

Current state as of 2026-03-12:

  • #530 scoring fix is still here (c5a4951)
  • #536 technical fix is now here too (eb45c23)
  • the temporary pandas upper bound is gone (ca2f1a7)
  • the full GitHub Actions matrix is green again, including windows python=3.9 dependencies=oldest

At this point, #535 is the effective delivery path for both #530 and the pandas 3 compatibility follow-up that was split into #536.

@leouieda
Copy link
Member

Hi @Gabriel-Goes thanks for submitting this! I'm going through the changes to see if I understand all that happened since this is now a sklearn and pandas compatibility fix. I'll get back to you as soon as possible.

Copy link
Member

@leouieda leouieda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Gabriel-Goes thank again for doing this! See some comments below. If the RegressorMixin is not absolutely necessary, I'd remove those and then this PR is a fix to the Pandas issue only.

@leouieda leouieda added this to the v1.9.0 milestone Mar 16, 2026
@Gabriel-Goes Gabriel-Goes requested a review from leouieda March 16, 2026 17:17
Copy link
Member

@leouieda leouieda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Merging this in.

@Gabriel-Goes please open another PR adding yourself to AUTHORS.md if you'd like to be included in the list of authors for the Zenodo archive of Verde. Thanks again for your help with this!

@leouieda
Copy link
Member

Also, come by my office at IAG and I can give you some Fatiando stickers 🙂

@leouieda leouieda changed the title Fix scoring compatibility with scikit-learn 1.8 Fix compatibility with Pandas > 3.0 Mar 16, 2026
@leouieda leouieda merged commit 1e4d881 into fatiando:main Mar 16, 2026
18 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.

BlockMean fails with pandas 3.0 in latest CI matrix

2 participants