def format_exp_floats ( decimals ) : threshold = 10 ** 5 return ( lambda n : "{:.{prec}e}" . format ( n , prec = decimals ) if n > threshold else "{:4.{prec}f}" . format ( n , prec = decimals ) )
format decimals as percentages in a column, 2 decimals python
sometimes the exp . column can be too large
def format_exp_floats(decimals):
    """
    sometimes the exp. column can be too large
    """
    threshold = 10 ** 5
    return (
        lambda n: "{:.{prec}e}".format(n, prec=decimals) if n > threshold else "{:4.{prec}f}".format(n, prec=decimals)
    )