home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 208092684

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/818#issuecomment-208092684 https://api.github.com/repos/pydata/xarray/issues/818 208092684 MDEyOklzc3VlQ29tbWVudDIwODA5MjY4NA== 1197350 2016-04-10T23:39:29Z 2016-04-10T23:39:29Z MEMBER

@shoyer, @jhamman I think this is ready for a review

There are two distinct features added here: 1. groupby works with multidimensional coordinate variables. (See example at the top of the PR.) 2. groupby accepts a new keyword group_bins, which is passed to pandas.cut to digitize the groups (have not documented this yet because I could use some feedback on the api). For now, the coordinates are labeled with the category labels determined by cut. Using the example array above

``` python

da.groupby('lat', bins=[0,15,20]).apply(lambda x : x.sum()) <xarray.DataArray (lat: 2)> array([1, 5]) Coordinates: * lat (lat) object '(0, 15]' '(15, 20]' ```

I'm not sure this is the ideal behavior, since the categories are hard to slice. For my purposes, I would rather assign an integer or float index to each bin using e.g. the central value of the bin.

note: Both of these features have problems when used with shortcut=True.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  146182176
Powered by Datasette · Queries took 0.645ms · About: xarray-datasette