reduceby and countby can accept an index or list of indices as the key

Lesson learned: even inline functions need to return `object` so exceptions
can be properly raised.
Merge pull request #42 from eriknw/reduceby_indices

reduceby and countby can accept an index or list of indices as the key