Skip to content

[PD010] - False positives with polarsdataframes #14301

@jlopezpena

Description

@jlopezpena

ruff version 0.7.3, pandas linting rules PD can trigger when dealing with objects from other libraries, like polars.

Minimal example:

import polars as pl

pl_df = pl.DataFrame([{"a": 1, "b": 2}, {"a": 3, "b": 4}])
pl_df.pivot(on="a", values="b")

This code raises a warning for rule [PD010](https://docs.astral.sh/ruff/rules/pandas-use-of-dot-pivot-or-unstack):

`.pivot_table` is preferred to `.pivot` or `.unstack`; provides same functionality

The warning is invalid, because the dataframe is not a pandas dataframe (and polars does not even have a pivot_table method!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions