Skip to content

Operator ">" not supported for types X and "Literal[0]" #1387

@schorlton-bugseq

Description

@schorlton-bugseq

Describe the bug

I have:
assert df.at["a", "b"] > 0

and am getting:

error: Operator ">" not supported for types "Scalar" and "Literal[0]"
    Operator ">" not supported for types "str" and "Literal[0]"
    Operator ">" not supported for types "bytes" and "Literal[0]"
    Operator ">" not supported for types "date" and "Literal[0]"
    Operator ">" not supported for types "datetime" and "Literal[0]"
    Operator ">" not supported for types "timedelta" and "Literal[0]"
    Operator ">" not supported for types "Timestamp" and "Literal[0]"
    Operator ">" not supported for types "Timedelta" and "Literal[0]"
    Operator ">" not supported for types "complex" and "Literal[0]" (reportOperatorIssue)

I would have thought this would be fine if .at returns an int or float (and this code runs fine) but maybe I'm missing something?

Please complete the following information:

  • pandas-stubs==2.3.2.250926
  • pyright v1.1.402

Thanks for your help!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    DataFrameDataFrame data structureIndexingRelated to indexing on series/frames, not to indexes themselvesNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions