python code for data generation & aggregation