Skip to content

API: ExtensionArray "serialize" and "from_serialized" methods for defining roundtripping behavior #25347

Closed
@mroeschke

Description

@mroeschke

xref #25308 (comment)

When EAs go through cython routines, they need to be converted to numpy arrays (and dtypes) first and then recast to the correct EA. This recast may require specific logic. For example, DatetimeTZDtypes need to be localized to UTC first before applying the dtype.

The proposal is for (optional) internal _serialize and _from_serialized methods that defines specific recasting logic for the EA. @jreback proposed something like:

serialized, dtype = EA._serialize()
original = EA._from_serialize(serialized, dtype)

Thoughts @jorisvandenbossche @TomAugspurger @jbrockmendel

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExtensionArrayExtending pandas with custom dtypes or arrays.Needs DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions