def bucketpanel(series, bins=None, by=None, cat=None):
 use_by = (by is not None)
 use_cat = (cat is not None)
 if (use_by and use_cat):
  raise Exception('must specify by or cat, but not both')
 elif use_by:
  if (len(by) != 2):
   raise Exception('must provide two bucketing series')
  (xby, yby) = by
  (xbins, ybins) = bins
  return _bucketpanel_by(series, xby, yby, xbins, ybins)
 elif use_cat:
  (xcat, ycat) = cat
  return _bucketpanel_cat(series, xcat, ycat)
 else:
  raise Exception('must specify either values or categories to bucket by')

def bucketpanel ( series , bins = None , by = None , cat = None ) : use_by = ( by is not None ) use_cat = ( cat is not None ) if ( use_by and use_cat ) : raise Exception ( 'must specify by or cat, but not both' ) elif use_by : if ( len ( by ) != 2 ) : raise Exception ( 'must provide two bucketing series' ) ( xby , yby ) = by ( xbins , ybins ) = bins return _bucketpanel_by ( series , xby , yby , xbins , ybins ) elif use_cat : ( xcat , ycat ) = cat return _bucketpanel_cat ( series , xcat , ycat ) else : raise Exception ( 'must specify either values or categories to bucket by' )
bucket data by two series to create summary panel parameters series : series bins : tuple e .