Skip to content

Commit 28e012c

Browse files
committed
COSMIT use sorted instead of list.sort in DictVectorizer
Guaranteed to return a list, even in Python 3.
1 parent 588bb7d commit 28e012c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sklearn/feature_extraction/dict_vectorizer.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ def fit(self, X, y=None):
9595
feature_names.add(f)
9696

9797
# sort the feature names to define the mapping
98-
feature_names = list(feature_names)
99-
feature_names.sort()
98+
feature_names = sorted(feature_names)
10099
self.vocabulary_ = dict((f, i) for i, f in enumerate(feature_names))
101100
self.feature_names_ = feature_names
102101

0 commit comments

Comments
 (0)