def convertTable(table, columns, function=float,
                 skip_errors=False):
    """convert values in particular columns of a table to a new type.

    Arguments
    ---------
    table : list
        Rows in the table. Each row is a list or tuple.
    columns : list
        Indices of columns to convert
    function : function
        Function to apply for conversion
    skip_errors : bool
        If True, errors are ignored and rows with unconvertible
        values are ignored. The default is to raise a ValueError.

    Returns
    -------
    table : list
        A new table with the converted values.

    """
    new_table = []
    for row in table:
        skip = False
        for c in columns:
            try:
                row[c] = float(row[c])
            except __HOLE__, msg:
                if skip_errors:
                    skip = True
                    break
                else:
                    raise ValueError(msg)

        if not skip:
            new_table.append(row)

    return new_table
dataset/ETHPy150Open CGATOxford/cgat/CGAT/CSV.py/convertTable