home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 390103257

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/issues/2157#issuecomment-390103257 https://api.github.com/repos/pydata/xarray/issues/2157 390103257 MDEyOklzc3VlQ29tbWVudDM5MDEwMzI1Nw== 1217238 2018-05-18T06:01:17Z 2018-05-18T06:01:17Z MEMBER

This was intentional behavior, but I agree that it is probably a mistake.

You can disable it by setting squeeze=False in groupby(), e.g., ``` arr = xr.DataArray( np.ones(3), dims=('x',), coords={ 'x': ('x', np.array([1, 3, 6])), } ) list(arr.groupby('x', squeeze=False))

[(1, <xarray.DataArray (x: 1)> array([1.]) Coordinates: * x (x) int64 1), (3, <xarray.DataArray (x: 1)> array([1.]) Coordinates: * x (x) int64 3), (6, <xarray.DataArray (x: 1)> array([1.]) Coordinates: * x (x) int64 6)] ```

This default behavior can be convenient sometimes because of fewer extra dimensions to worry about. In principle, squeezing makes sense if the grouped coordinate has all unique values, but here we aren't even doing that (I don't know why).

I have two suggested fixes: - squeeze=True should only rely on unique values. Otherwise this really is nearly impossible to predict. - We should deprecate squeeze=True as the default value, and change this default behavior in the next major release.

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