Skip to content

chore(dependencies): support pandas 3#2723

Merged
wpbonelli merged 2 commits intomodflowpy:developfrom
wpbonelli:pandas3
Feb 27, 2026
Merged

chore(dependencies): support pandas 3#2723
wpbonelli merged 2 commits intomodflowpy:developfrom
wpbonelli:pandas3

Conversation

@wpbonelli
Copy link
Member

@wpbonelli wpbonelli commented Feb 27, 2026

Recently pandas 3 was released.

Only minimal changes needed from us, namely

  • switching timedelta units from deprecated "d" to "D"
  • a fix in the model splitter where columns that were previously renamed automatically on dataframe construction must now be renamed manually due to stricter dataframe init method requirements

There are two other potentially relevant changes

  1. String dtype

Pandas 3 will infer string columns as str dtype instead of object. Code checking dtype == 'object' for strings will break. I think we are safe as internal dtype checks are generally on numpy arrays, not pandas DataFrames. We kind of luck out for having not migrated everything over to pandas.

When we do pd.DataFrame.from_records(recarray), numpy string fields will get converted to str dtype instead of object. But I don't think we need to care, indexing, selection, etc should all work as before.

  1. Copy-on-Write (CoW)

As far as I can tell we use .loc internally, no chained assignments, so we should be good.

@wpbonelli wpbonelli added dependencies Pull requests that update a dependency file maintenance labels Feb 27, 2026
@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 58.33333% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.4%. Comparing base (556c088) to head (33f590e).
⚠️ Report is 136 commits behind head on develop.

Files with missing lines Patch % Lines
flopy/mf6/data/mfdataplist.py 60.0% 4 Missing ⚠️
flopy/export/metadata.py 0.0% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2723      +/-   ##
===========================================
+ Coverage     55.5%    72.4%   +16.9%     
===========================================
  Files          644      674      +30     
  Lines       124135   130560    +6425     
===========================================
+ Hits         68947    94586   +25639     
+ Misses       55188    35974   -19214     
Files with missing lines Coverage Δ
flopy/utils/mtlistfile.py 88.9% <100.0%> (ø)
flopy/export/metadata.py 23.2% <0.0%> (ø)
flopy/mf6/data/mfdataplist.py 71.6% <60.0%> (-7.2%) ⬇️

... and 569 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wpbonelli wpbonelli added this to the 3.11 milestone Feb 27, 2026
@wpbonelli wpbonelli marked this pull request as ready for review February 27, 2026 20:55
@wpbonelli wpbonelli merged commit 2ac89a2 into modflowpy:develop Feb 27, 2026
19 checks passed
@wpbonelli wpbonelli deleted the pandas3 branch February 27, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant