def main(): ranking = load_obj(RANKING_FILE_NAME) for k, v in ranking.iteritems(): if len(v) < 50: continue draw_hist_with_stats(v)
def draw_ranks(start_dir, threshold): for title, path in pkl_files(start_dir): plt.figure(figsize=(18.0,15.0)) plt.suptitle(title) rank = load_obj(path) num_subplots = sum(len(rank[k]) >= threshold for k in rank) i = 0 for k in rank: if len(rank[k]) < threshold: continue print "%s: %d out of %d (row %g, rank %s)" % (path, i, len(rank), ceil(num_subplots/3.0), k) plt.subplot(ceil(num_subplots/3.0), 3, i) draw_hist_with_stats(k, rank[k], xlabel='1-year Percentage Change') i += 1 plt.show()