Skip to content

[Proposal] Allow open boundaries when some of them are undefined for DatetimeIndex #23200

@Adirio

Description

@Adirio

Problem description

When creating a DatetimeIndex partially-bounded, i.e., only specifying either start or end the use of a closed parameter different from None was intended to be disallowed. This behaviour is bugged as shown in #23198. #23199 solves this bug.

Before #23199, the DatetimeIndex was successfully created. The result contained one less than the requested periods in some cases as shown in #23176.

After #23199, a ValueError will be raised as it seemed to be intended.

The proposal is to allow closed parameters different to None for partially-bounded DatetimeIndexes. The behaviour should be as defined in the following table

Periods Ommited parameter Closed Current number of items After #23199 Proposed number of items
N end None N N N
N end "left" N-1 ValueError N
N end "right" N ValueError N
N start None N N N
N start "left" N ValueError N
N start "right" N-1 ValueError N

Metadata

Metadata

Assignees

No one assigned

    Labels

    DatetimeDatetime data dtypeEnhancementNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions