astral-sh / ruff

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

Flags rule PD011 but it is not correct #13495

Closed ghsanti closed 1 month ago

ghsanti commented 1 month ago
a = list()
a.values

Use .to_numpy() instead of .values

Maybe as a first fix it can check for the pandas module, I'm not using it, just as in the snippet above.

MichaReiser commented 1 month ago

Thanks. Yeah, that makes sense. We're working on type inference that will improve the precision of panda's rules.

For now, I recommend you to disable the rule by using ruff.lint.ignore = ["PD011"]).

I merge this issue into https://github.com/astral-sh/ruff/issues/6432 which discusses the problem holistically for all pandas rules.