home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 351588123

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/1765#issuecomment-351588123 https://api.github.com/repos/pydata/xarray/issues/1765 351588123 MDEyOklzc3VlQ29tbWVudDM1MTU4ODEyMw== 1217238 2017-12-14T02:19:32Z 2017-12-14T02:19:32Z MEMBER

I looked into this a little more. The fix is to make a copy of bins inside _func: ```python def _func(data, bin_data, bins): """Group unlabeled array 'data' according to values in 'bin_data' using bins defined in 'bins' and sum all values""" bins = np.array(bins) labels = bins[1:] da_data = xr.DataArray(data, name='data') da_bin_data = xr.DataArray(bin_data, name='bin_data')

binned = da_data.groupby_bins(da_bin_data, bins, labels=labels,
                          include_lowest=True).sum()
return binned

```

The problem is that broadcasting (inside xarray.apply_ufunc/np.vectorize) produces readonly arrays, but the pandas function doesn't handle it properly (https://github.com/pandas-dev/pandas/issues/18773). We could potentially add a work-around in pandas to fix this, but the ultimate source issue is https://github.com/cython/cython/issues/1605

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