Skip to content

subtracing a TimeStampSeries from a Timestamp not supported #1189

Closed
@Dr-Irv

Description

@Dr-Irv

Describe the bug
Type checking missing for Timestamp - TimestampSeries

To Reproduce

import pandas as pd
ts1 = pd.to_datetime(pd.Series(["2022-03-05", "2022-03-06"]))
assert isinstance(ts1.iloc[0], pd.Timestamp)
one_ts = ts1.iloc[0]
reveal_type(one_ts - ts1)

revealed type should be TimedeltaSeries.

Note that ts1 - one_ts works fine.

Need to add an overload in pandas-stubs/_libs/tslibs/timestamps.pyi

Please complete the following information:

  • OS: Windows
  • OS Version 11
  • python version 3.10
  • version of type checker pyright 1.386
  • version of installed pandas-stubs - development copy

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions