Address pandas 2.0 deprecation warnings in FBIHateCrimePublications - #2111
Open
niveditasing wants to merge 10 commits into
Open
Address pandas 2.0 deprecation warnings in FBIHateCrimePublications#2111niveditasing wants to merge 10 commits into
niveditasing wants to merge 10 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
saanikaaa
reviewed
Jul 30, 2026
saanikaaa
approved these changes
Jul 30, 2026
| "validator": "GOLDENS_CHECK", | ||
| "params": { | ||
| "golden_files": "../../../../golden_data/golden_observations_table14.csv", | ||
| "input_files": "../../../../table14/table14_output.csv" |
Contributor
There was a problem hiding this comment.
[P2] Validation Config — Missing Date Freshness Validation
- File:
scripts/fbi/hate_crime/validation_config.json - Finding:
validation_config.jsonsets upDELETED_RECORDS_PERCENTandGOLDENS_CHECKfor all tables, but omits date freshness validation. - Impact: Golden summary reports intentionally exclude
MaxDateso that data refreshes do not fail when new observation dates are ingested. However, if a future refresh silently fails to ingest new publication years or regresses, the golden checks alone will still pass. - Recommendation: Add a
SQL_VALIDATORdate freshness check tovalidation_config.json(e.g. verifying thatMaxDateis at least 2023 or within allowable lag):{ "rule_id": "check_max_date_freshness", "description": "Verifies latest observation year is within 3 years of current date", "validator": "SQL_VALIDATOR", "params": { "query": "SELECT MAX(CAST(SUBSTRING(CAST(MaxDate AS VARCHAR), 1, 4) AS INT)) AS max_year FROM stats", "condition": "max_year >= (EXTRACT(YEAR FROM CURRENT_DATE) - 3)" } }
Contributor
There was a problem hiding this comment.
I feel this check would be helpful. pls check again. Other golden checks wont ensure latest date data is present.
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
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.
Test Results: https://storage.mtls.cloud.google.com/datcom-import-test/scripts/fbi/hate_crime/FBIHateCrimePublications/2026_07_28T04_41_11_827936_07_00/input0/validation/validation_output.csv