Changed EDCalc.avg_cost to use sum() in place of reduce()