def num_row_elements(row):
    """Get number of elements in CSV row."""
    try:
        rowset = set(row)
        rowset.discard('')
        return len(rowset)
    except TypeError:
        return 0
