def _freedman_diaconis_bins(a):
 a = np.asarray(a)
 h = ((2 * iqr(a)) / (len(a) ** (1 / 3)))
 if (h == 0):
  return int(np.sqrt(a.size))
 else:
  return int(np.ceil(((a.max() - a.min()) / h)))

def _freedman_diaconis_bins ( a ) : a = np . asarray ( a ) h = ( ( 2 * iqr ( a ) ) / ( len ( a ) ** ( 1 / 3 ) ) ) if ( h == 0 ) : return int ( np . sqrt ( a . size ) ) else : return int ( np . ceil ( ( ( a . max ( ) - a . min ( ) ) / h ) ) )
calculate number of hist bins using freedman-diaconis rule .