vectorizer = DictVectorizer()
vectorized_sparse = vectorizer.fit_transform(train_as_dicts)
vectorized_sparse
vectorized_array = vectorized_sparse.toarray()
vectorized_array
Using DictVectorizer with sklearn DecisionTreeClassifier