def guess_type(s):
    """ attempt to convert string value into numeric type """
    sc = s.replace(',', '') # remove comma from potential numbers

    try:
        return int(sc)
    except ValueError:
        pass

    try:
        return float(sc)
    except ValueError:
        pass

    return s
attempt to convert string value into numeric type