-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Originally from #974
For boolean indexing:
da[key]wherekeyis a boolean labelled array (with any number of dimensions) is made equivalent toda.where(key.reindex_like(ds), drop=True). This matches the existing behavior ifkeyis a 1D boolean array. For multi-dimensional arrays, even though the result is now multi-dimensional, this coupled with automatic skipping of NaNs means thatda[key].mean()gives the same result as in NumPy.da[key] = valuewherekeyis a boolean labelled array can be made equivalent toda = da.where(*align(key.reindex_like(da), value.reindex_like(da)))(that is, the three argument form ofwhere).da[key_0, ..., key_n]where all ofkey_iare boolean arrays gets handled in the usual way. It is anIndexingErrorto supply multiple labelled keys if any of them are not already aligned with as the corresponding index coordinates (and share the same dimension name). If they want alignment, we suggest users simply writeda[key_0 & ... & key_n].
braham-snyder, tqfjo, shaprann, max-sixty and smheidrich