pydata / duck-array-discussion

A repository for discussing duck array hierarchies with Python
7 stars 0 forks source link

Addition/removal of layers in a nested duck array #5

Open jthielen opened 3 years ago

jthielen commented 3 years ago

In many use cases, we can have "multiply nested" duck arrays rather than just two interacting duck array types. This creates a couple issues:

Note: this issue is mostly relevant to array types higher on DAG, as they are the ones handling the respective interactions.

Specific Goals

Current State

Xarray has limited support (downcasting contained data to ndarray with as_numpy), but other libraries have none or next to none. https://github.com/pydata/xarray/issues/3245 (which may have been mistakenly/prematurely closed) as many different ideas on how to handle other minimally nested cases. Otherwise, it is entirely up to the user to break apart and reconstruct the nested array structures.

Suggested Paths Forward

This is admittedly a poorly described issue, so perhaps a good idea would be to collect use cases/user stories in which we need to be able to cast wrapped types between each other in multiply nested arrays, and then see if any ideas for common interfaces emerge.

SimonHeybrock commented 2 years ago

See https://github.com/pydata/duck-array-discussion/issues/6#issuecomment-1253259393 for a suggestion addressing the removal of layers.