def selection_change(self, obj, attrname, old, new): #self.make_brand_plot #self.set_children() #curdoc().add(self) bdf = self.brand_df min_idx, max_idx = shoes_func.min_max_range(ranges, bdf['price']) self.configure_brand_source(min_idx, max_idx) self.make_brand_source() self.make_brand_plot(min_idx, max_idx) self.set_children() curdoc().add(self)
def configure_brand_source(self, min_idx=0, max_idx=MAX_IDX): bdf = self.brand_df #min_idx, max_idx = shoes_func.min_max_range(ranges, bdf['price']) min_idx, max_idx = shoes_func.min_max_range(orig_order, bdf['price']) counts = [0] * (max_idx - min_idx + 1) for i in bdf.index: ans = bdf.ix[i] #idx = int(ans['price'] + 100)//100 + 1 idx = int(ans['price'] // 100) print "idx is ", idx print "price is ", ans['price'] #Categorical stuff #xcat.append(ranges[idx-2]) #_shoedf.loc[i, 'brand_y'] = (counts[idx - min_idx] - 0.5*counts[idx - min_idx]) _shoedf.loc[i, 'brand_y'] = (counts[idx - min_idx]) + 0.5 counts[idx - min_idx] = counts[idx - min_idx] + 1 #quad stuff #xvals.append(idx - 0.25) #rightvals.append(idx + 0.25) #bottoms.append(counts[idx]/2) #tops.append(counts[idx] + 0.5) #fills.append(brand_to_color[ans['brand']]) return None
def configure_brand_source(self, min_idx=0, max_idx=MAX_IDX): bdf = self.brand_df #min_idx, max_idx = shoes_func.min_max_range(ranges, bdf['price']) min_idx, max_idx = shoes_func.min_max_range(orig_order, bdf['price']) counts = [0] * (max_idx - min_idx + 1) for i in bdf.index: ans = bdf.ix[i] #idx = int(ans['price'] + 100)//100 + 1 idx = int(ans['price']//100) print "idx is ", idx print "price is ", ans['price'] #Categorical stuff #xcat.append(ranges[idx-2]) #_shoedf.loc[i, 'brand_y'] = (counts[idx - min_idx] - 0.5*counts[idx - min_idx]) _shoedf.loc[i, 'brand_y'] = (counts[idx - min_idx]) + 0.5 counts[idx - min_idx] = counts[idx - min_idx] + 1 #quad stuff #xvals.append(idx - 0.25) #rightvals.append(idx + 0.25) #bottoms.append(counts[idx]/2) #tops.append(counts[idx] + 0.5) #fills.append(brand_to_color[ans['brand']]) return None