def get_cumsum(self): from numpy.ma.core import cumsum values=self.distribution.keys() values.sort() proportions=[] for value in values: proportions.append(self.distribution.get(value)) cdf=cumsum(proportions) return cdf
def get_cumsum_percent(self): from numpy.ma.core import cumsum values=self.distribution.keys() values.sort() proportions=[] for value in values: proportions.append(self.distribution.get(value)) cdf=cumsum(proportions) total=sum(proportions) cdf_prop=[] for i in range(len(cdf)): cdf_prop.append(float(cdf[i])/total*100) return cdf_prop