Skip to content

ENH: should shift return same dtype objects as input? #2761

Closed
@jreback

Description

@jreback

see the example in #2759

should certain operations, e.g. shift preserve the dtype of the output object,
simulated like this (rather than return an upcasted version)
this obviously is easier if we had an integer NA

would have to add a fillna keyword to shift to make this work
(so we don't have to guess on the fill value for integer/bool types)

mask.astype('O').shift().fillna(0).astype(mask.dtype)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions