def _force_float ( v ) : try : return float ( v ) except Exception as exc : return float ( 'nan' ) logger . warning ( 'Failed to convert {} to float with {} error. Using 0 instead.' . format ( v , exc ) )
does python automatically return a float
Converts given argument to float . On fail logs warning and returns 0 . 0 .
def _force_float(v):
    """ Converts given argument to float. On fail logs warning and returns 0.0.

    Args:
        v (any): value to convert to float

    Returns:
        float: converted v or 0.0 if conversion failed.

    """
    try:
        return float(v)
    except Exception as exc:
        return float('nan')
        logger.warning('Failed to convert {} to float with {} error. Using 0 instead.'.format(v, exc))