[pandas-vet] Make example error out-of-the-box (PD002)#22561
Merged
amyreese merged 1 commit intoastral-sh:mainfrom Jan 20, 2026
Merged
[pandas-vet] Make example error out-of-the-box (PD002)#22561amyreese merged 1 commit intoastral-sh:mainfrom
pandas-vet] Make example error out-of-the-box (PD002)#22561amyreese merged 1 commit intoastral-sh:mainfrom
Conversation
|
amyreese
reviewed
Jan 13, 2026
Comment on lines
+29
to
+30
| /// students = pd.read_csv("students.csv") | ||
| /// students.sort_values("name", inplace=True) |
Member
There was a problem hiding this comment.
I'd prefer names that are more generic
Suggested change
| /// students = pd.read_csv("students.csv") | |
| /// students.sort_values("name", inplace=True) | |
| /// data = pd.read_csv("data.csv") | |
| /// data.sort_values("column", inplace=True) |
Contributor
Author
There was a problem hiding this comment.
I chose to leave the name since that matches how some of the other examples in pandas-vet are:
https://docs.astral.sh/ruff/rules/pandas-use-of-dot-is-null/
import pandas as pd
animals_df = pd.read_csv("animals.csv")
pd.isnull(animals_df)https://docs.astral.sh/ruff/rules/pandas-use-of-dot-ix/ (The one I copied from)
import pandas as pd
students_df = pd.read_csv("students.csv")
students_df.ix[0] # 0th row or row with label 0?
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
Part of #18972
This PR makes pandas-use-of-inplace-argument (PD002)'s example error out-of-the-box.
Old example
New example
The "Use instead" section was also updated to emphasize the benefits gained from being able to use the method chaining style.
Test Plan
N/A, no functionality/tests affected