-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
When I try to iterate over the object grouped
returned by groupby_bins
, I found that the empty group is missing silently. Here is a simple case:
array = xr.DataArray(np.arange(4), dims='dim_0')
# one of these bins will be empty
bins = [0,4,5]
grouped = array.groupby_bins('dim_0', bins)
for i, group in enumerate(grouped):
print(str(i)+' '+group)
When a bin contains no samples (bin of (4, 5]), the empty group will be dropped. Then how to iterate over the full bins even when some bins contain nothing? I've read this related issue #1019.
But my case here need the correct order in grouped and empty groups need to be iterated over.