Skip to content

Series.__add__ will not accept DateOffset #673

Closed
@Daverball

Description

@Daverball

series.pyi contains overloads for most datetime like series and scalar values, but not for DateOffset, even though pandas appears to support it. In most cases Timedelta for offsetting aTimestamp series is sufficient, but not when operating on calendar months/years.

To Reproduce

import pandas as pd

s = pd.date_range('2020-01-01', '2020-02-01')
s + pd.DateOffset(months=+3)

mypy will report the error (No overload variant of "__add__" of Series matches argument type "DateOffset")

  • OS: Linux (OpenSUSE Tumbleweed)
  • Python 3.10
  • mypy 1.0.1
  • pandas-stubs 2.0.1.230501

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