Trims zeros, leaving just one before the decimal points if need be.

def _trim_zeros_float(str_floats, na_rep='NaN'):
    """
    Trims zeros, leaving just one before the decimal points if need be.
    """
    trimmed = str_floats

    def _is_number(x):
        return (x != na_rep and not x.endswith('inf'))

    def _cond(values):
        finite = [x for x in values if _is_number(x)]
        return (len(finite) > 0 and all(x.endswith('0') for x in finite) and
                not (any(('e' in x) or ('E' in x) for x in finite)))

    while _cond(trimmed):
        trimmed = [x[:-1] if _is_number(x) else x for x in trimmed]

    # leave one 0 after the decimal points if need be.
    return [x + "0" if x.endswith('.') and _is_number(x) else x
            for x in trimmed]