Skip to content

Support for pandas Extension Arrays #5287

Closed
@Hoeze

Description

@Hoeze

Is your feature request related to a problem? Please describe.
I started writing an ExtensionArray which is basically a Tuple[Array[str], Array[int], Array[int], Array[str], Array[str]].
Its scalar type is a Tuple[str, int, int, str, str].

This is working great in Pandas, I can read and write Parquet as well as csv with it.
However, as soon as I'm using any .to_xarray() method, it gets converted to a NumPy array of objects.
Also, converting back to Pandas keeps a Series of objects instead of my extension type.

Describe the solution you'd like
Would it be possible to support Pandas Extension Types on coordinates?
It's not necessary to compute anything on them, I'd just like to use them for dimensions.

Describe alternatives you've considered
I was thinking over implementing a NumPy duck array, but I have never tried this and it looks quite complicated compared to the Pandas Extension types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-arraysrelated to flexible array support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions