def hist_from_counts(counts, normalize=False, cumulative=False, to_str=False, sep='<STR_LIT:U+002C>', min_bin=None, max_bin=None):
counters = [dict((i, c)for i, c in enumerate(counts))]<EOL>intkeys_list = [[c for c in counts_dict if (isinstance(c, int) or (isinstance(c, float) and int(c) == c))]<EOL>for counts_dict in counters]<EOL>min_bin, max_bin = min_bin or <NUM_LIT:0>, max_bin or len(counts) - <NUM_LIT:1><EOL>histograms = []<EOL>for intkeys, counts in zip(intkeys_list, counters):<EOL><INDENT>histograms += [OrderedDict()]<EOL>if not intkeys:<EOL><INDENT>continue<EOL><DEDENT>if normalize:<EOL><INDENT>N = sum(counts[c] for c in intkeys)<EOL>for c in intkeys:<EOL><INDENT>counts[c] = float(counts[c]) / N<EOL><DEDENT><DEDENT>if cumulative:<EOL><INDENT>for i in range(min_bin, max_bin + <NUM_LIT:1>):<EOL><INDENT>histograms[-<NUM_LIT:1>][i] = counts.get(i, <NUM_LIT:0>) + histograms[-<NUM_LIT:1>].get(i - <NUM_LIT:1>, <NUM_LIT:0>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for i in range(min_bin, max_bin + <NUM_LIT:1>):<EOL><INDENT>histograms[-<NUM_LIT:1>][i] = counts.get(i, <NUM_LIT:0>)<EOL><DEDENT><DEDENT><DEDENT>if not histograms:<EOL><INDENT>histograms = [OrderedDict()]<EOL><DEDENT>aligned_histograms = []<EOL>for i in range(min_bin, max_bin + <NUM_LIT:1>):<EOL><INDENT>aligned_histograms += [tuple([i] + [hist.get(i, <NUM_LIT:0>) for hist in histograms])]<EOL><DEDENT>if to_str:<EOL><INDENT>return str_from_table(aligned_histograms, sep=sep, max_rows=<NUM_LIT> * <NUM_LIT:2> + <NUM_LIT:1>)<EOL><DEDENT>return aligned_histograms<EOL>
Compute an emprical histogram, PMF or CDF in a list of lists

    TESTME: compare results to hist_from_values_list and hist_from_float_values_list