PolicyEngine / microdf

Analysis tools for working with survey microdata as DataFrames.
http://pslmodels.github.io/microdf
MIT License
12 stars 10 forks source link

Fix bugs and add partial groupby support #166

Closed nikhilwoodruff closed 3 years ago

nikhilwoodruff commented 3 years ago

Should fix #165 , I no longer get any crashes.

GroupBys seem to be slightly complicating things, because the groupby objects returned when calling df.groupby or series.groupby don't directly call the already overridden series and dataframe functions. So this adds a MicroSeriesGroupBy class which, intruding as little as possible onto existing groupby functionality, intercepts the calls to median, mean, etc. and passes onto the overriden functions. As for dataframes, the df.groupby function now returns a dataframegroupby object, but the internal seriesgroupby objects have been cast to MicroSeriesGroupBy objects so they use weights. This means: