home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 173494017

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
173494017 MDU6SXNzdWUxNzM0OTQwMTc= 987 Return a scalar instead of DataArray when the return value is a scalar 1063143 closed 0     11 2016-08-26T16:37:36Z 2016-08-28T20:19:19Z 2016-08-28T20:19:19Z NONE      

Hi,

I'm not sure how devs will feel about this, but I wanted to ask because I'm getting into this issue frequently.

Currently many methods such as .min(), .max(), .mean() returns a DataArray even for the cases where the return value is a scaler. For example,

``` python import numpy as np import xarray as xr test = xr.DataArray(data=np.ones((10, 10)))

In [6]: test.min() Out[6]: <xarray.DataArray ()> array(1.0) ```

which makes a lot of other things break down and I have to use test.min().values or float(test.min()). I think it would be great that these methods return a scalar when the return value is a scaler. For example,

python In [7]: np.ones((10, 10)).mean() Out[7]: 1.0

Thank you!

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/987/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 11 rows from issue in issue_comments
Powered by Datasette · Queries took 1.33ms · About: xarray-datasette