Skip to content

BUG: find_common_type([interval[f8], interval[i8]]) returns object #38299

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
jbrockmendel opened this issue Dec 4, 2020 · 1 comment · Fixed by #38373
Closed

BUG: find_common_type([interval[f8], interval[i8]]) returns object #38299

jbrockmendel opened this issue Dec 4, 2020 · 1 comment · Fixed by #38373
Labels
API Design Interval Interval data type

Comments

@jbrockmendel
Copy link
Member

I would expect it to return interval[f8], analogous to what we'd get with find_common_type([f8, i8])

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 4, 2020
@jorisvandenbossche jorisvandenbossche added API Design Interval Interval data type and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 6, 2020
@jorisvandenbossche
Copy link
Member

IntervalDtype doesn't have its own specialization of _get_common_dtype, so it falls back to the base class implementation, which only looks at exact dtype equality.

So this can be fixed by adding a custom _get_common_dtype, and getting the common type of the underlying left/right arrays (the subdtype).
Now, I am not sure if this would be "better" or expected behaviour or not (not enough actual experience with intervals to judge that)

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

Successfully merging a pull request may close this issue.

2 participants