Support multi-dimensional grouped operations and group_over
See original GitHub issueMulti-dimensional grouped operations should be relatively straightforward – the main complexity will be writing an N-dimensional concat that doesn’t involve repetitively copying data.
The idea with group_over
would be to support groupby operations that act on a single element from each of the given groups, rather than the unique values. For example, ds.group_over(['lat', 'lon'])
would let you iterate over or apply to 2D slices of ds
, no matter how many dimensions it has.
Roughly speaking (it’s a little more complex for the case of non-dimension variables), ds.group_over(dims)
would get translated into ds.groupby([d for d in ds.dims if d not in dims])
.
Related: #266
Issue Analytics
- State:
- Created 9 years ago
- Reactions:15
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Applying a function to a multidimensional array with grouping ...
I have a multidimensional array v[x,y,z] and I would like to apply a function to the array along the z dimension using a...
Read more >Using groupby() and apply() over more than a single ...
I'm trying to use xarray's split-apply-combine approach for processing a 3-D dataset with dimensions: time, lon, and lat.
Read more >ADP 3-07 - Army Publishing Directorate
Executing stability operations supports the fundamentals of stabilization. Army stability operations ... favoring one group over another.
Read more >GroupBy: Group and Bin Data - Xarray
Group by operations work on both Dataset and DataArray objects. Most of the examples focus on grouping by a single one-dimensional variable, although...
Read more >The impact of individual versus group rewards on work group ...
This will help managers to identify and focus attention on work group situations where the design ... as well as on the environment...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@shoyer -
I want to look into putting a PR together for this. I’m looking for the same functionality that you get with a pandas Series or DataFrame:
The motivation comes in making a Hovmoller diagram. What we need is this functionality:
If you can point me in the right direction, I’ll see if I can put something together.
For (2) I think it makes sense to extend the existing groupby to deal with multiple dimensions. Ie, let it take an iterable of dimension names.
Then we’d have something similar to the SQL groupby, which is a good thing.
By the way, in #527 we were considering using this approach to make the faceted plots on both rows and columns.