diff --git a/awkward/array/jagged.py b/awkward/array/jagged.py index 4699e362..efa5bde9 100644 --- a/awkward/array/jagged.py +++ b/awkward/array/jagged.py @@ -1444,6 +1444,11 @@ def _reduce(self, ufunc, identity, dtype, regularaxis): content = ufunc.reduce(content, axis=axis) out = ufunc.reduceat(content, nonterminal)[:len(out)] + if len(out) < len(thyself): + tmp = self.numpy.empty((len(thyself),) + out.shape[1:], dtype=out.dtype) + tmp[:len(out)] = out + out = tmp + out[thyself.starts == thyself.stops] = identity if regularaxis is None: diff --git a/awkward/version.py b/awkward/version.py index 8d031f0c..7d5b5578 100644 --- a/awkward/version.py +++ b/awkward/version.py @@ -4,7 +4,7 @@ import re -__version__ = "0.11.0" +__version__ = "0.11.1" version = __version__ version_info = tuple(re.split(r"[-\.]", __version__)) diff --git a/tests/test_issues.py b/tests/test_issues.py index fd33bab3..cc7bc285 100644 --- a/tests/test_issues.py +++ b/tests/test_issues.py @@ -17,3 +17,9 @@ def test_issue49(self): a = JaggedArray([2], [5], [1, 2, 3, 4, 5]) m = JaggedArray([0], [3], [False, False, True]) assert a[m].tolist() == [[5]] + + def test_issue144(self): + x = fromiter([[], [0.5], [0.6], []]) + isloose = fromiter([[], [False], [True], []]) + assert x[isloose].tolist() == [[], [], [0.6], []] + assert x.sum().tolist() == [0.0, 0.5, 0.6, 0.0]