ENH: Add grouping utilities code

Pulled out the grouputils stuff from #1133. This stuff is generally useful, if not exactly what we'll need in each case. I found myself re-implementing some of this functionality in the survival stuff. Better to have it in master to iterate on.

There's a missing function `group_demean` in there. I assume these were written by @josef-pkt given that they're pure numpy and notes to self docs ;). Do you have this lying around somewhere? // cc @vincentarelbundock