Skip to content

TYP: Allow time manipulation functions to accept date and timedelta objects#20763

Merged
charris merged 1 commit intonumpy:maintenance/1.22.xfrom
BvB93:datetime
Jan 8, 2022
Merged

TYP: Allow time manipulation functions to accept date and timedelta objects#20763
charris merged 1 commit intonumpy:maintenance/1.22.xfrom
BvB93:datetime

Conversation

@BvB93
Copy link
Copy Markdown
Member

@BvB93 BvB93 commented Jan 7, 2022

Backport of #20750


Closes #20746

The time manipulation functions (e.g. busday_count) are somewhat unique in that they unsafely cast many of their inputs to datetime64 or timedelta64 arrays. This unsafe casting means that the conventionally used npt.ArrayLike alias is not comprehensive enough to capture all valid input types, most notably excluding datetime.date and datetime.datetime.

This PR thus expands the relevant argument types with support for more datetime-based objects.

@charris
Copy link
Copy Markdown
Member

charris commented Jan 8, 2022

Thanks Bas.

@BvB93 BvB93 deleted the datetime branch January 10, 2022 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants