def categorical_to_numerical(vector_categorical, name_to_number_map=None):
    """Transform a categorical variable (str items) into a numerical variable (int items)."""
    if not name_to_number_map:
        name_to_number_map = dict()
        counter = 1
    else:
        counter = max(name_to_number_map.values()) + 1
    vector_numerical = list()
    for name in vector_categorical:
        number = counter
        if name not in name_to_number_map:
            name_to_number_map[name] = number
            counter += 1
        else:
            number = name_to_number_map[name]
        vector_numerical.append(number)
    return vector_numerical, name_to_number_map
