You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This results in an IndexError. This is mildly confusing, it took me a little while to figure out the NaN's were to blame. I'm guessing the NaN doesn't get filtered out everywhere.
The traceback:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-2-267ba57bc264> in <module>()
15 ds["id"].values[0,0] = np.nan
16
---> 17 ds.groupby("id").apply(standardize)
C:\Miniconda3\envs\main\lib\site-packages\xarray\core\groupby.py in apply(self, func, **kwargs)
607 kwargs.pop('shortcut', None) # ignore shortcut if set (for now)
608 applied = (func(ds, **kwargs) for ds in self._iter_grouped())
--> 609 return self._combine(applied)
610
611 def _combine(self, applied):
C:\Miniconda3\envs\main\lib\site-packages\xarray\core\groupby.py in _combine(self, applied)
614 coord, dim, positions = self._infer_concat_args(applied_example)
615 combined = concat(applied, dim)
--> 616 combined = _maybe_reorder(combined, dim, positions)
617 if coord is not None:
618 combined[coord.name] = coord
C:\Miniconda3\envs\main\lib\site-packages\xarray\core\groupby.py in _maybe_reorder(xarray_obj, dim, positions)
428
429 def _maybe_reorder(xarray_obj, dim, positions):
--> 430 order = _inverse_permutation_indices(positions)
431
432 if order is None:
C:\Miniconda3\envs\main\lib\site-packages\xarray\core\groupby.py in _inverse_permutation_indices(positions)
109 positions = [np.arange(sl.start, sl.stop, sl.step) for sl in positions]
110
--> 111 indices = nputils.inverse_permutation(np.concatenate(positions))
112 return indices
113
C:\Miniconda3\envs\main\lib\site-packages\xarray\core\nputils.py in inverse_permutation(indices)
52 # use intp instead of int64 because of windows :(
53 inverse_permutation = np.empty(len(indices), dtype=np.intp)
---> 54 inverse_permutation[indices] = np.arange(len(indices), dtype=np.intp)
55 return inverse_permutation
56
IndexError: index 11 is out of bounds for axis 0 with size 11
Expected Output
My assumption was that it would throw out the values that fall within the NaN group, likepandas:
Code Sample
Problem description
This results in an IndexError. This is mildly confusing, it took me a little while to figure out the NaN's were to blame. I'm guessing the NaN doesn't get filtered out everywhere.
The traceback:
Expected Output
My assumption was that it would throw out the values that fall within the NaN group, like
pandas
:Out:
Output of
xr.show_versions()
The text was updated successfully, but these errors were encountered: