def getMapColumn2Type(rows, ignore_empty=False, get_max_values=False):
    """map fields to types based on rows.

    Preference is Int to Float to String.

    If get_max_values is set to true, the maximum values for integer
    columns are returned in a dictionary.
    """

    headers = rows[0].keys()
    map_column2type = {}
    is_full = {}

    max_values = {}

    for row in rows:
        for h in headers:

            if row[h] == "":
                continue

            is_full[h] = True

            if isinstance(row[h], int):
                t = types.IntType
                if h not in max_values:
                    max_values[h] = int(row[h])
                else:
                    max_values[h] = max(h, int(row[h]))

            elif isinstance(row[h], float):
                t = types.FloatType
            else:
                continue

            map_column2type[h] = t

    ignored = []
    for h in headers:
        if h not in map_column2type:
            if is_full in h or not ignore_empty:
                map_column2type[h] = types.StringType
            else:
                ignored.append(h)
    if get_max_values:
        return map_column2type, ignored, max_values
    else:
        return map_column2type, ignored
dataset/ETHPy150Open CGATOxford/cgat/CGAT/CSV.py/getMapColumn2Type/swapped operands of `in`