issues: 1452291042
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1452291042 | I_kwDOAMm_X85WkDPi | 7295 | einops integration? | 5635139 | closed | 0 | 5 | 2022-11-16T21:23:03Z | 2023-06-14T18:20:05Z | 2023-06-14T18:20:05Z | MEMBER | Is your feature request related to a problem?I've been following https://github.com/arogozhnikov/einops with interest, and thought it would be worth raising whether we could offer an xarray integration, eventually inspired by the Einops offers a string query to do common array operations. There's a good intro at https://github.com/arogozhnikov/einops/blob/master/docs/1-einops-basics.ipynb The Describe the solution you'd likeBecause our dimension names are full names, it wouldn't be quite as terse, and it has lots of overlap with our existing operations. But I find string queries are often easy to understand, particularly for those who have less experience with xarray but are familiar with einsum & frends [^1]. Applying einops to xarrayThe einops example, (no xarray yet):
This could likely be something like, noting that we don't need the string before the
...or, if we wanted to name the new dimension rather than take an implicit dimension name like
...or if we wanted a method on a DataArray:
Sometimes we would want the lvalue; e.g. to unstack:
...and the same principles apply for reductions such as
...would be equivalent to: ```python ims.mean('batch') orims.groupby(['height', 'width', 'color']).mean(...) ``` [^1]: I frequently find myself using Describe alternatives you've consideredNo response Additional contextThis probably needs a champion to drive, and realistically that's probably not me for quite a while. But if we can get consensus that this would be interesting, and someone is up for doing it, I think this could be a v cool feature. I'll also tag @arogozhnikov for info |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/7295/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |