Skip to content

Allow using datetime64[ns, UTC] in IntervalDtype #46666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Allow using datetime64[ns, UTC] in IntervalDtype #46666

wants to merge 2 commits into from

Conversation

helgehatt
Copy link

The current regexp doesn't allow the use of comma in the interval subtype, which means this statement fails

pd.IntervalIndex.from_arrays([1, 2], [2, 3], dtype='interval[datetime64[ns, UTC], right]')

with TypeError: data type 'interval[datetime64[ns, UTC], right]' not understood

The proposed change allows the use of comma inside square brackets in the subtype.

The current regexp doesn't allow the use of comma in the interval `subtype`, which means this statement fails
```
pd.IntervalIndex.from_arrays([1, 2], [2, 3], dtype='interval[datetime64[ns, UTC], right]')
```
with `TypeError: data type 'interval[datetime64[ns, UTC], right]' not understood`

The proposed change allows the use of comma inside square brackets in the `subtype`.
@pep8speaks
Copy link

pep8speaks commented Apr 6, 2022

Hello @helgehatt! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-04-06 13:37:04 UTC

@simonjayhawkins
Copy link
Member

Thanks @helgehatt for the PR.

The current regexp doesn't allow the use of comma in the interval subtype, which means this statement fails

If there is no existing issue for this, can you open one.

@simonjayhawkins simonjayhawkins added Datetime Datetime data dtype Interval Interval data type labels Apr 6, 2022
Copy link
Member

@phofl phofl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please add tests

@github-actions
Copy link
Contributor

github-actions bot commented May 9, 2022

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@simonjayhawkins
Copy link
Member

Thanks @helgehatt for the PR.

The current regexp doesn't allow the use of comma in the interval subtype, which means this statement fails

If there is no existing issue for this, can you open one.

opened #46999

closing this as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Interval Interval data type Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants