def get_int(row, key, ignore_start=0, ignore_end=None):
    """ row is the csv row to get an integer from, 
    key is that row's column that we want to cast as int,
    start/end is the number of leading/trailing characters to ignore.
    return 0 if could not convert 
    """
    try:
        s = row[key][ignore_start:(-ignore_end if ignore_end else None)]
        val = int(s.replace(',', ''))  # replace 1,000 by 1000
    except ValueError:  # raised by int('') or int('---')
        val = 0
    return val