sturges = lambda n: int(log2(n) + 1) square_root = lambda n: int(sqrt(n)) from scipy.stats import kurtosis doanes = lambda data: int(1 + log(len(data)) + log(1 + kurtosis(data) * (len(data) / 6.) ** 0.5))
n = len(titanic) sturges(n), square_root(n), doanes(titanic.fare.dropna())
titanic.fare.hist(bins=doanes(titanic.fare.dropna()))