def summary ( cvsfile, write_func, *args ):
    """Show the column names.
    """
    fsnames = cvsfile.fieldnames
    data_dict = {}
    for f in fsnames:
        data_dict[f]=[]
    #print "\n".join(map( lambda x:":".join(map(str,x)) ,enumerate(fsnames))  )
    for l in cvsfile:
        for f in fsnames:
            v = l.setdefault(f,None)
            if v and v!="NA":
                data_dict[f].append(v)
    write_func( "colnum:colname\tsum,mean,median,std,cutoff\n" )
    for (i,f) in enumerate(fsnames):
        try:
            v_array = map(float,data_dict[f])
            v_sum = "%.2f" % sum(v_array)
            v_mean = "%.2f" % mean(v_array)
            v_median = "%.2f" % median(v_array)
            v_std = "%.2f" % std(v_array, float(v_mean))
            v_cutoff = "%.2f" % (float(v_mean)+float(v_std))
        except __HOLE__:
            (v_sum,v_mean,v_median,v_std,v_cutoff)=["NA"]*5
        write_func( "%d:%s\t%s,%s,%s,%s,%s\n" % (i,f,v_sum,v_mean,v_median,v_std,v_cutoff ))
dataset/ETHPy150Open taoliu/taolib/Scripts/ce_histone_matrix.py/summary