Skip to content

Commit

Permalink
fix invalid comparision with unicode string
Browse files Browse the repository at this point in the history
  • Loading branch information
kmaehashi committed Jul 19, 2016
1 parent c2c1507 commit 34984da
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jubakit/base.py
Expand Up @@ -160,8 +160,10 @@ def _add_to_datum(self, d, t, k, v):
if t == self.STRING:
d.add_string(k, unicode_t(v))
elif t == self.NUMBER:
if v != '':
d.add_number(k, float(v))
# Empty unicode/bytes values cannot be cast to float; treat them as NA.
if isinstance(v, (unicode_t, bytes)) and len(v) == 0:
return
d.add_number(k, float(v))
elif t == self.BINARY:
d.add_binary(k, v)
elif t == self.AUTO or t == self.INFER:
Expand Down

0 comments on commit 34984da

Please sign in to comment.