sportsref/nfl/pbp.py
def _loc_to_features(loc):
    """Converts a location string "{Half}, {YardLine}" into a tuple of those
    values, the second being an int.

    :l: The string from the play by play table representing location.
    :returns: A tuple that separates out the values, making them missing
    (np.nan) when necessary.

    """
    if loc:
        if isinstance(loc, basestring):
            loc = loc.strip()
            if ' ' in loc:
                r = loc.split()
                r[0] = r[0].lower()
                r[1] = int(r[1])
            else:
                r = (np.nan, int(loc))
        elif isinstance(loc, float):
            return (np.nan, 50)
    else:
        r = (np.nan, np.nan)
    return r
def _loc_to_features(loc):
    """Converts a location string "{Half}, {YardLine}" into a tuple of those
    values, the second being an int.

    :l: The string from the play by play table representing location.
    :returns: A tuple that separates out the values, making them missing
    (np.nan) when necessary.

    """
    if loc:
        if isinstance(loc, basestring):
            loc = loc.strip()
            if ' ' in loc:
                r = loc.split()
                r[0] = r[0].lower()
                r[1] = int(r[1])
            else:
                r = (np.nan, int(loc))
        elif isinstance(loc, float):
            return (np.nan, 50)
    else:
        r = (np.nan, np.nan)
    return r
def _loc_to_features ( loc ) : if loc : if isinstance ( loc , basestring ) : loc = loc . strip ( ) if ' ' in loc : r = loc . split ( ) r [ 0 ] = r [ 0 ] . lower ( ) r [ 1 ] = int ( r [ 1 ] ) else : r = ( np . nan , int ( loc ) ) elif isinstance ( loc , float ) : return ( np . nan , 50 ) else : r = ( np . nan , np . nan ) return r
Converts a location string "{Half}, {YardLine}" into a tuple of those
    values, the second being an int.

    :l: The string from the play by play table representing location.
    :returns: A tuple that separates out the values, making them missing
    (np.nan) when necessary.
Converts a location string { Half } { YardLine } into a tuple of those values the second being an int .