def smartconvert(data_string):
    """
    Attempts to convert a raw string into the following data types, returns the first successful:
        int, float, str
    """
    type_list = [int, float]
    for var_type in type_list:
        try:
            converted_var=var_type(data_string.strip())
            #Check for inifinite values:
            if converted_var == float('Inf'):
                converted_var = 1e6;
            return converted_var
        except ValueError:
            pass
    #No match found
    return str(data_string.strip())