Skip to content

ENH: add same_value casting and use it in astype #29558

@mattip

Description

@mattip

xref #29129 which implements ndarray.astype(newdtype, casting='same_value') but only for built-in NumPy numeric types.

In order to make the same_value casting work for user-defined dtypes, we need to think about

Also, it seems same_value casting does not fit neatly into the post-NEP-50 casting rules we currently have, since it explicitly excludes a value-based answer to can_cast.

@seberg, I tried to summarize the essence of the problem solved by mattip#94. Did I miss or misunderstand something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions