home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 217584777

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
217584777 MDU6SXNzdWUyMTc1ODQ3Nzc= 1335 `cumsum` providing correct behavior for non-coordinate DataArrays? 4295853 open 0     5 2017-03-28T14:45:12Z 2019-03-31T05:41:09Z   CONTRIBUTOR      

In the case of a DataArray without coordinates, should cumsum work without specifying an axis, e.g., da.cumsum() is valid? This is not currently the obtained behavior.

```python In [1]: import xarray as xr imp In [2]: import numpy as np

In [3]: da = xr.DataArray(np.arange(10))

In [4]: da Out[4]: <xarray.DataArray (dim_0: 10)> array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) Dimensions without coordinates: dim_0

In [5]: da.cumsum(axis=0) Out[5]: <xarray.DataArray (dim_0: 10)> array([ 0, 1, 3, 6, 10, 15, 21, 28, 36, 45]) Dimensions without coordinates: dim_0

In [6]: da.cumsum()

ValueError Traceback (most recent call last) <ipython-input-5-4ff0efc782ee> in <module>() ----> 1 da.cumsum()

/Users/pwolfram/src/xarray/xarray/core/common.pyc in wrapped_func(self, dim, axis, skipna, keep_attrs, kwargs) 17 keep_attrs=False, kwargs): 18 return self.reduce(func, dim, axis, keep_attrs=keep_attrs, ---> 19 skipna=skipna, allow_lazy=True, **kwargs) 20 else: 21 def wrapped_func(self, dim=None, axis=None, keep_attrs=False,

/Users/pwolfram/src/xarray/xarray/core/dataarray.pyc in reduce(self, func, dim, axis, keep_attrs, kwargs) 1146 summarized data and the indicated dimension(s) removed. 1147 """ -> 1148 var = self.variable.reduce(func, dim, axis, keep_attrs, kwargs) 1149 return self._replace_maybe_drop_dims(var) 1150

/Users/pwolfram/src/xarray/xarray/core/variable.pyc in reduce(self, func, dim, axis, keep_attrs, allow_lazy, **kwargs) 898 if dim is None and axis is None: 899 raise ValueError("must supply either single 'dim' or 'axis' " --> 900 "argument to %s" % (func.name)) 901 902 if dim is not None:

ValueError: must supply either single 'dim' or 'axis' argument to cumsum

```

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

Links from other tables

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