Skip to content

Unsupported operand types for > ("Series[Any]" and "Timedelta") #175

Closed
@acjh

Description

@acjh

pandas supports comparison for Series[Timedelta] and Timedelta, but pandas-stubs does not.

import pandas as pd

s = pd.Series([pd.Timedelta(minutes=2)])
result = s > pd.Timedelta(hours=1)

Using mypy:

$ mypy tests.py
tests.py:4: error: Unsupported operand types for > ("Series[Any]" and "Timedelta")

Version of installed pandas-stubs: 1.4.3.220724

https://stackoverflow.com/questions/73064606/how-can-i-stop-mypy-complaining-when-comparing-a-pd-series-to-single-value

Note: This is similar to #27, which reported for Timestamp.

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