1234567891011121314151617181920212223 |
- # Aggregrate given clusters
- import pandas as p
-
- def aggregator(widedf, clusdf):
- clusters = clusdf.cluster.unique()
- clusters.sort()
- aggv = {}
- qlow = lambda x: x.quantile(0.250)
- qhigh = lambda x: x.quantile(0.750)
- for c in clusters:
- icps = clusters[clusters.cluster == c].icp_id.values
- subdf = widedf[icps]
- agged = subdf.agg('median', 'mean', qlow, qhigh)
- print(agged)
-
-
- def main():
- wd = p.read_pickle()
- cd = p.read_pickle()
-
-
- if __name__ == "__main__":
- main()
|