Skip to content

TYP/DOC: date_range (and other *_range) functions support timedelta as freq parameter #48460

Closed
@ojdo

Description

@ojdo

I'm coming from a question in pandas-dev/pandas-stubs#223 asking about where mypy complains about me using a timedelta as a "freq" argument to function pandas.date_range:

Argument "freq" to "date_range" has incompatible type "timedelta"; expected "Union[str, BaseOffset]"

Since #6307 this is officially supported in at least for date_range, but very probably for most other range functions.

From what I learned over in pandas-stubs, this repo's code (or rather docstrings) should explicitly document the new type support so that pandas-stubs may infer that for their stubs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsTimedeltaTimedelta data typeTypingtype annotations, mypy/pyright type checking

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions