reduceat is somewhat quirky https://github.com/numpy/numpy/pull/4238