Skip to content

Commit

Permalink
py2-py3 data exchange bugfix (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
François Laurent committed Apr 6, 2018
1 parent 67e9888 commit 825fede
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions tramway/core/scaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,12 @@ def scaled(self, points, asarray=False):
cols = columns(points)
coltype = type(cols[0])
if type(self.columns[0]) is not coltype:
if coltype is str:
if coltype is bytes:
coerce = lambda s: s.encode('utf-8')
else:
coerce = lambda s: s.decode('utf-8')
elif coltype is bytes:
coerce = lambda s: s.decode('utf-8')
else:
if coltype is bytes:
coerce = lambda s: s.encode('utf-8')
self.columns = [ coerce(c) for c in self.columns ]
self.euclidean = [ coerce(c) for c in self.euclidean ]
else:
coerce = lambda s: s.decode('utf-8')
self.columns = [ coerce(c) for c in self.columns ]
self.euclidean = [ coerce(c) for c in self.euclidean ]
points = points[self.columns]
else:
if self.center is not None and isstructured(self.center):
Expand Down

0 comments on commit 825fede

Please sign in to comment.