'Find the optimal number of bins and update the bin countaccordingly.
Available methods : Freedman
Scott'

def optimize_binning(self, method='Freedman'):

    nobs = len(self.data)
    if (method == 'Freedman'):
        IQR = (self.ppf_emp(0.75) - self.ppf_emp(0.25))
        width = ((2 * IQR) * (nobs ** ((-1.0) / 3)))
    elif (method == 'Scott'):
        width = ((3.49 * np.std(self.data)) * (nobs ** ((-1.0) / 3)))
    self.nbin = (self.binlimit.ptp() / width)
    return self.nbin
