def bucketcat(series, cats):
 if (not isinstance(series, Series)):
  series = Series(series, index=np.arange(len(series)))
 cats = np.asarray(cats)
 unique_labels = np.unique(cats)
 unique_labels = unique_labels[com.notnull(unique_labels)]
 data = {}
 for label in unique_labels:
  data[label] = series[(cats == label)]
 return DataFrame(data, columns=unique_labels)

def bucketcat ( series , cats ) : if ( not isinstance ( series , Series ) ) : series = Series ( series , index = np . arange ( len ( series ) ) ) cats = np . asarray ( cats ) unique_labels = np . unique ( cats ) unique_labels = unique_labels [ com . notnull ( unique_labels ) ] data = { } for label in unique_labels : data [ label ] = series [ ( cats == label ) ] return DataFrame ( data , columns = unique_labels )
produce dataframe representing quantiles of a series parameters series : series cat : series or same-length array bucket by category; mutually exclusive with by returns dataframe .