def binned_statistic(x, values, statistic='mean', bins=10, range=None):
 try:
  N = len(bins)
 except TypeError:
  N = 1
 if (N != 1):
  bins = [np.asarray(bins, float)]
 if (range is not None):
  if (len(range) == 2):
   range = [range]
 (medians, edges, binnumbers) = binned_statistic_dd([x], values, statistic, bins, range)
 return BinnedStatisticResult(medians, edges[0], binnumbers)

def binned_statistic ( x , values , statistic = 'mean' , bins = 10 , range = None ) : try : N = len ( bins ) except TypeError : N = 1 if ( N != 1 ) : bins = [ np . asarray ( bins , float ) ] if ( range is not None ) : if ( len ( range ) == 2 ) : range = [ range ] ( medians , edges , binnumbers ) = binned_statistic_dd ( [ x ] , values , statistic , bins , range ) return BinnedStatisticResult ( medians , edges [ 0 ] , binnumbers )
compute a binned statistic for one or more sets of data .