Repository navigation
fix(nwis): index format_response's frame without set_index(inplace=True) - #460
Merged
thodson-usgs merged 1 commit intoOct 29, 2026
Merged
Conversation
pandas 3.1.0 deprecates the inplace keyword of set_index with a Pandas4Warning, a DeprecationWarning subclass. Every nwis getter that returns a time-indexed frame emitted it, and the 3.13 and 3.14 CI jobs failed test_nested_calls_emit_one_warning on the second warning; the 3.10 jobs install pandas 2 and passed. The in-place call was deliberate: without it, set_index copies every column when copy-on-write is off. Popping the key columns off the shallow copy is what the in-place call did internally, so the frames are identical and peak memory is unchanged on pandas 2.3.3 and 3.1.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pandas 3.1.0 (released 10/2026) deprecates
set_index(..., inplace=True)with aPandas4Warning, which subclassesDeprecationWarning.nwis.format_responsecalls it for every frame with adatetimecolumn, so the 3.13 and 3.14 test jobs onmainfailtest_nested_calls_emit_one_warningon the second warning. The 3.10 jobs install pandas 2.x and pass.The in-place call was deliberate: on pandas 2 with copy-on-write off,
set_indexwithout it copies every column. Popping the key columns off the shallow copy is whatset_index(inplace=True)does internally, so that property is kept without the deprecated keyword.Evidence
Pandas4Warning, on pandas 3.1.0 (Python 3.13), 2.3.3 (3.12) and 3.0.5 (3.12).format_responsebefore and after, on pandas 3.1.0 and 2.3.3 (single-site, multi-site,multi_index=False, GeoDataFrame, string datetimes, peaks):Merge Danger
Door: two-way
Blast Radius: none
format_responsereturns the same frames. The only visible difference is that pandas 3.1 users no longer see the warning.🤖 Generated with Claude Code