Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

groupby_bins along two dims simultaneously #1056

Closed
fmaussion opened this issue Oct 21, 2016 · 3 comments · Fixed by #9372
Closed

groupby_bins along two dims simultaneously #1056

fmaussion opened this issue Oct 21, 2016 · 3 comments · Fixed by #9372

Comments

@fmaussion
Copy link
Member

fmaussion commented Oct 21, 2016

I probably missed it, but what is the way to apply groupby (or rather groupby_bins) in order to achieve the following in xarray?

da = xr.DataArray(np.arange(16).reshape((4, 4)))
da
<xarray.DataArray (dim_0: 4, dim_1: 4)>
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [ 8,  9, 10, 11],
       [12, 13, 14, 15]])
Coordinates:
  * dim_0    (dim_0) int64 0 1 2 3
  * dim_1    (dim_1) int64 0 1 2 3

# should be aggregated to (in case of summing) to obtain
dagg
<xarray.DataArray (dim_0: 2, dim_1: 2)>
array([[10, 18],
       [42, 50]])
Coordinates:
  * dim_1    (dim_1) int64 0 2
  * dim_0    (dim_0) int64 0 2
@shoyer
Copy link
Member

shoyer commented Oct 21, 2016

The short answer is -- it doesn't work yet. We need multi-dimensional groupby first: #924

@fmaussion
Copy link
Member Author

fmaussion commented Oct 22, 2016

Thanks Stephan. Looking forward to see it implemented!

@stale
Copy link

stale bot commented Oct 4, 2020

In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity

If this issue remains relevant, please comment here or remove the stale label; otherwise it will be marked as closed automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants