Address pandas 2.0 deprecation warnings in FBIHateCrimePublications#2111
Open
niveditasing wants to merge 2 commits into
Open
Address pandas 2.0 deprecation warnings in FBIHateCrimePublications#2111niveditasing wants to merge 2 commits into
niveditasing wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the preprocessing scripts for FBI hate crime tables 13 and 14 by replacing the deprecated pandas fillna(method='ffill') calls with the modern .ffill() method. I have no feedback to provide as the changes are correct and align with modern pandas best practices.
balit-raibot
approved these changes
Jul 23, 2026
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: Replaced deprecated .fillna(method='ffill') with the direct .ffill() method in the preprocessing scripts for Table 13 and Table 14 & added golden files.
Why this change was made
Pandas 2.0+ Compatibility & Deprecation Cleanup
In modern versions of Pandas (2.0.0 and above), calling .fillna() with the method argument (e.g., method='ffill') is deprecated and
raises a FutureWarning (or errors in newer releases). The recommended and idiomatic pandas way to forward-fill missing values is calling
.ffill() directly.
Functional Correctness (Propagating Grouped Row Headers)
The FBI publication Excel files for Tables 13 and 14 use merged/visually-grouped rows where the State and Agency Type are only defined
on the first row of each section. Subsequent rows for specific cities/agencies are read as NaN by pandas.
and mapped to its parent State and Agency Type.