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
ENH: Add grouping utilities
Grouping sort method
ENH: Reindex Grouping method
minor Grouping bug
STY: PEP-8 cleanup
ENH: Use existing helper functions.
BUG: Preserve shape of input.
DOC: Add some documentation to Groupings methods
BUG: Fix import.
ENH: Use properties for dummies.
BUG: Make sure sorting is done properly. Needs tests.
BUG: Fix group_demeans thinko
Looking at it, I think group_demeans was just a thinko.
ENH: New-style class
As far as I remember, there are still unfinished and unused parts in the group-utils that I have written.
Most of it was written in support of the cluster and panel robust standard errors. I didn't clean up or finish parts that I didn't need at the time. (Some of it was based on old sandbox code and might not be fully adapted to the different pattern used here.)
Ok, well, I don't use any of that. The Grouping class is used in the panel and I will use it in the survival code. It needs to be ever so slightly generalized (always assumes two-level panel x time groupings, which it doesn't need to). I'm doing that now.
REF: Refactor grouping class
TST: Test grouping class
Should be mostly functional. Will need a little bit of a refactor for both Panel (subclass, hard-coded groups) and grouped Survival -- will likely supercede what's in the Survival WIP right now, maybe gain some stuff from it.
COMPAT: Fix for older versions of pandas.
This is now targeting pandas 0.12.0. I wouldn't be surprised if there are failures on older versions.