Skip to content

MAINT: Remove deprecated pandas inplace= arguments - #4171

Open
thaliamontreux wants to merge 1 commit into
Unidata:mainfrom
thaliamontreux:fix-pandas4-inplace
Open

thaliamontreux wants to merge 1 commit into
Unidata:mainfrom
thaliamontreux:fix-pandas4-inplace

Conversation

@thaliamontreux

Copy link
Copy Markdown

Description

Removes all uses of the deprecated inplace= argument on pandas DataFrame
methods. Pandas 4 removes the argument entirely (PDEP-8)
and pandas-dev raises Pandas4Warning for each call, which fails the
nightly test suite (#4070 -- the test_gempak_surface_file leg).

Reassigns the returned frames instead, which is behavior-identical on
all supported pandas versions.

Sites fixed

  • src/metpy/io/metar.py: set_index, rename, drop_duplicates
  • tests/io/test_gempak.py: sort_index
  • tests/plots/test_declarative.py: rename (x2)

Checklist

  • Tests pass (tests/io/test_metar.py)
  • Contributes to Nightly build is failing #4070 (remaining nightly failures are upstream:
    NumPy 2.5 .shape deprecation inside cartopy img_transform,
    matplotlib image-baseline drift, xarray-dev attrs churn)

Pandas 4 (PDEP-8) removes the inplace argument from DataFrame methods,
and pandas-dev now emits Pandas4Warning for every use, which fails the
nightly test suite. Reassign the returned frames instead -- identical
behavior on all supported pandas versions.

Sites fixed:
- src/metpy/io/metar.py: set_index, rename, drop_duplicates
- tests/io/test_gempak.py: sort_index
- tests/plots/test_declarative.py: rename (x2)
@thaliamontreux
thaliamontreux requested a review from a team as a code owner October 20, 2026 07:45
@thaliamontreux
thaliamontreux requested review from dopplershift and removed request for a team October 20, 2026 07:45
@thaliamontreux

Copy link
Copy Markdown
Author

Note for reviewers: the three failing macOS legs are pre-existing on main (see the latest Nightly run on 7910b5c, which fails the same jobs). This is #4148 -- image-test warnings (max_open_warning / shapely create_collection) promoted to errors on the conda macOS envs -- and is addressed by #4170. No part of this diff is responsible; the identical jobs pass on #4147 which carries the filter fix.

This branch has not been deployed

No deployments
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