1. from sklearn.feature_extraction import DictVectorizer
    2. measurements = [
    3. {'city': 'Dubai', 'temperature': 33.},
    4. {'city': 'London', 'temperature': 12.},
    5. {'city': 'Francisco', 'temperature': 18.},
    6. {'city': 'San Francisco', 'temperature': 11},
    7. ]
    8. vec = DictVectorizer()
    9. print(vec.fit_transform(measurements).toarray())
    10. print(vec.get_feature_names())