def build_aggregates(): writer = None years = range(2006, 2010) for year in years: yr = str(year) # fname = "Agg_%s.%s" %(str(yr), "xls") simu = SurveySimulation() simu.set_config(year=yr) simu.set_param() simu.set_survey() inflator = get_loyer_inflator(year) simu.inflate_survey({'loyer': inflator}) simu.compute() agg = Aggregates() agg.set_simulation(simu) agg.compute() if writer is None: writer = ExcelWriter(str(fname_all)) agg.aggr_frame.to_excel(writer, yr, index=False, header=True, float_format="%.2f") print agg.aggr_frame.to_string() del simu del agg import gc gc.collect() writer.save()
def build_aggregates(): writer = None years = range(2006,2010) for year in years: yr = str(year) # fname = "Agg_%s.%s" %(str(yr), "xls") simu = SurveySimulation() simu.set_config(year = yr) simu.set_param() simu.set_survey() inflator = get_loyer_inflator(year) simu.inflate_survey({'loyer' : inflator}) simu.compute() agg = Aggregates() agg.set_simulation(simu) agg.compute() if writer is None: writer = ExcelWriter(str(fname_all)) agg.aggr_frame.to_excel(writer, yr, index= False, header= True, float_format="%.2f") print agg.aggr_frame.to_string() del simu del agg import gc gc.collect() writer.save()
def test_gini(): """ Compute Gini coefficients """ years = range(2006, 2010) for year in years: yr = str(year) # fname = "Agg_%s.%s" %(str(yr), "xls") simu = SurveySimulation() simu.set_config(year = yr) simu.set_param() inflator = get_loyer_inflator(year) simu.inflate_survey({'loyer' : inflator}) simu.compute() inequality = Inequality() inequality.set_simulation(simu) inequality.compute() print inequality.inequality_dataframe print inequality.poverty del simu
def test_gini(): """ Compute Gini coefficients """ years = range(2006, 2010) for year in years: yr = str(year) # fname = "Agg_%s.%s" %(str(yr), "xls") simu = SurveySimulation() simu.set_config(year=yr) simu.set_param() inflator = get_loyer_inflator(year) simu.inflate_survey({'loyer': inflator}) simu.compute() inequality = Inequality() inequality.set_simulation(simu) inequality.compute() print inequality.inequality_dataframe print inequality.poverty del simu