Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f18a07a

Browse files
jnothmanogrisel
authored andcommitted
FIX don't use dict comprehension for Py 2.6
1 parent 255895d commit f18a07a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sklearn/preprocessing/label.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,8 @@ def transform(self, y):
547547
A matrix such that `y_indicator[i, j] = 1` iff `classes_[j]` is in
548548
`y[i]`, and 0 otherwise.
549549
"""
550-
yt = self._transform(y, {k: i for i, k in enumerate(self.classes_)})
550+
class_to_index = dict(zip(self.classes_, range(len(self.classes_))))
551+
yt = self._transform(y, class_to_index)
551552
return yt.toarray()
552553

553554
def _transform(self, y, class_mapping):

0 commit comments

Comments
 (0)