Skip to content

REF: NumericIndex.union determine casting dtype using concat logic #37258

Open
@jbrockmendel

Description

@jbrockmendel

ATM NumericIndex._union has special casting rules for what dtype it casts to when unioning with another NumericIndex of a different dtype.

        # Right now, we treat union(int, float) a bit special.
        # See https://github.com/pandas-dev/pandas/issues/26778 for discussion
        # We may change union(int, float) to go to object.
        # float | [u]int -> float  (the special case)
        # <T>   | <T>    -> T
        # <T>   | <U>    -> object

Instead, we should re-use code (not sure where this lives, cc @jorisvandenbossche ?) from concat (maybe even Block.putmask?) to determing the appropriate upcast dtype.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API - ConsistencyInternal Consistency of API/BehaviorDtype ConversionsUnexpected or buggy dtype conversionsIndexRelated to the Index class or subclassesRefactorInternal refactoring of codesetopsunion, intersection, difference, symmetric_difference

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions