Skip to content

Commit

Permalink
add error if drop_index is negative (dask#8064)
Browse files Browse the repository at this point in the history
  • Loading branch information
neelriyer committed Sep 13, 2021
1 parent 618aedf commit 9f0b00f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dask/array/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,8 @@ def map_blocks(
dtype = apply_infer_dtype(func, args, original_kwargs, "map_blocks")

if drop_axis:
if any(i < 0 for i in drop_axis):
raise ValueError(f"Expected drop_axis to be non-negative; got {drop_axis}.")
out_ind = tuple(x for i, x in enumerate(out_ind) if i not in drop_axis)
if new_axis is None and chunks is not None and len(out_ind) < len(chunks):
new_axis = range(len(chunks) - len(out_ind))
Expand Down

0 comments on commit 9f0b00f

Please sign in to comment.