Skip to content

BUG: Allow using datetime64[ns, UTC] in IntervalDtype #46999

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
3 tasks done
simonjayhawkins opened this issue May 11, 2022 · 0 comments · Fixed by #47208
Closed
3 tasks done

BUG: Allow using datetime64[ns, UTC] in IntervalDtype #46999

simonjayhawkins opened this issue May 11, 2022 · 0 comments · Fixed by #47208
Labels
Bug Datetime Datetime data dtype Interval Interval data type

Comments

@simonjayhawkins
Copy link
Member

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

dates = pd.date_range("2022", periods=3, tz="UTC")
print(pd.IntervalIndex.from_arrays(dates[:-1], dates[1:]))
print(
    pd.IntervalIndex.from_arrays(
        ["2022-01-01", "2022-01-02"],
        ["2022-01-02", "2022-01-03"],
        dtype="interval[datetime64[ns, UTC], right]",
    )
)

Issue Description

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

xref #46666

works for Interval of naive timeseries...

dates = pd.date_range("2022", periods=3)
print(pd.IntervalIndex.from_arrays(dates[:-1], dates[1:]))
print(
    pd.IntervalIndex.from_arrays(
        ["2022-01-01", "2022-01-02"],
        ["2022-01-02", "2022-01-03"],
        dtype="interval[datetime64[ns], right]",
    )
)

Expected Behavior

IntervalIndex([(2022-01-01, 2022-01-02], (2022-01-02, 2022-01-03]], dtype='interval[datetime64[ns, UTC], right]')

Installed Versions

.

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

Successfully merging a pull request may close this issue.

1 participant