def binned_statistic_2d(x, y, values, statistic='mean', bins=10, range=None, expand_binnumbers=False):
 try:
  N = len(bins)
 except TypeError:
  N = 1
 if ((N != 1) and (N != 2)):
  xedges = yedges = np.asarray(bins, float)
  bins = [xedges, yedges]
 (medians, edges, binnumbers) = binned_statistic_dd([x, y], values, statistic, bins, range, expand_binnumbers=expand_binnumbers)
 return BinnedStatistic2dResult(medians, edges[0], edges[1], binnumbers)

def binned_statistic_2d ( x , y , values , statistic = 'mean' , bins = 10 , range = None , expand_binnumbers = False ) : try : N = len ( bins ) except TypeError : N = 1 if ( ( N != 1 ) and ( N != 2 ) ) : xedges = yedges = np . asarray ( bins , float ) bins = [ xedges , yedges ] ( medians , edges , binnumbers ) = binned_statistic_dd ( [ x , y ] , values , statistic , bins , range , expand_binnumbers = expand_binnumbers ) return BinnedStatistic2dResult ( medians , edges [ 0 ] , edges [ 1 ] , binnumbers )
compute a bidimensional binned statistic for one or more sets of data .