question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Groupby exclude dimension

See original GitHub issue

Is there some way to do a groupby operation where some dimension is excluded from the operation, e.g., a vectorized version of something like this:

vertlevels = [ds.vel.sel(nVertLevels=i).groupby('y').mean() for i in ds.nVertLevels]
xavgvel = xr.concat(vertlevels, 'nVertLevels')

The application here is to average 3D data in the x coordinate to the unique y coordinates, but not the vertical coordinate.

Thus, we are basically looking for something that allows a coordinate to be excluded from the groupby operation, e.g., in this case the vertical coordinate. Ideally this would also be possible within the context of the groupby_bins operation.

Any ideas on how this should work or a pointer on how to implement this type of operation more cleanly with existing infrastructure is greatly appreciated. This appears to be related to #324 and especially (perhaps identically) #924.

cc @vanroekel, @shoyer, @jhamman, @rabernat, @MaximilianR

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
pwolframcommented, Sep 21, 2016

Thanks for making everyone’s life so much better via xarray and for helping us all to contribute to this process @shoyer!

1reaction
shoyercommented, Sep 21, 2016

My guess is that this could be implemented pretty quickly on top of #924, which is currently on hold while I finish up #964.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to exclude more than one group in a groupby using ...
I know in order to exclude one group from a groupby you can use the following code: grouped = df. groupby(['Region']) df1 =...
Read more >
Group by: split-apply-combine — pandas 1.5.2 documentation
GroupBy dropna​​ By default NA values are excluded from group keys during the groupby operation. However, in case you want to include NA...
Read more >
Group Your Data - Tableau Help
To remove members from an existing group: In the Data pane, right-click the group field, and then click Edit Group. In the Edit...
Read more >
Pandas GroupBy - GeeksforGeeks
Splitting : It is a process in which we split data into group by applying ... that is indexed the same (same size)...
Read more >
Monitoring Query Language (MQL) Reference
Filter out (exclude) dimension values in an MQL expression. ... For example, groupBy(availabilityDomain) groups results by availability ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found