astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.
https://docs.astral.sh/ruff
MIT License
32.09k stars 1.07k forks source link

Variable name `df` raises PD901 #3330

Open janosh opened 1 year ago

janosh commented 1 year ago

PD901 df is a bad variable name. Be kinder to your future self.

df is the standard variable name for data frames in the pandas/polars communities and should be excluded from PD901.

charliermarsh commented 1 year ago

Hmm, it is the exact intent of the rule in pandas-vet, but maybe we should remove it, it's considered "very opinionated", so it feels off to me that Ruff enables it whenever users enable pandas-vet.

https://github.com/deppen8/pandas-vet#very-opinionated-warnings

janosh commented 1 year ago

Oops, should have read the docs. Was under the false impression df was being flagged on account of being only 2 letters.

charliermarsh commented 1 year ago

@edgarrmondragon - Do you have an opinion on whether this rule stays or goes?