home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 459389883

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
459389883 MDU6SXNzdWU0NTkzODk4ODM= 3037 groupby on empty DataArray raises StopIteration 1305639 closed 0     2 2019-06-21T22:10:38Z 2019-07-23T01:04:35Z 2019-07-23T01:04:35Z NONE      

This seems similar to #1764 and #2240 so apologies if it is a duplicate, but I have a minimal example where it happens on an empty DataArray:

Code Sample

```python import xarray as xr xr.DataArray([], dims='dim').groupby('dim').mean() # raises StopIteration

```

Problem Description

Using groupby on an empty DataArray or Dataset raises StopIteration. It should raise a more meaningful error.

In particular, I had this issue in a function I was calling inside of a generator, so the StopIteration just broke out of the generator and it took some digging to figure out what was going wrong in my code.

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.5.final.0 python-bits: 64 OS: Linux OS-release: 3.10.0-862.14.4.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.utf8 LOCALE: en_US.UTF-8 xarray: 0.10.7 pandas: 0.23.0 numpy: 1.14.3 scipy: 1.1.0 netCDF4: 1.4.0 h5netcdf: 0.6.1 h5py: 2.7.1 Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.17.5 distributed: 1.21.8 matplotlib: 2.2.2 cartopy: None seaborn: 0.8.1 setuptools: 39.1.0 pip: 10.0.1 conda: None pytest: 3.5.1 IPython: 6.4.0 sphinx: 1.7.4
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3037/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

  • 3 rows from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 80.932ms · About: xarray-datasette