New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importing numbers from csv doesn't work #377

vilos opened this Issue May 31, 2016 · 0 comments


None yet
2 participants

vilos commented May 31, 2016

>>> with open('ex.csv') as f:
...     print

>>>tbl = petl.fromcsv('ex.csv', quoting=csv.QUOTE_NONNUMERIC)
>>>print petl.look(tbl)

Traceback (most recent call last):
  File "", line 16, in <module>
    print petl.look(tbl)
  File ".../petl/petl/util/", line 104, in __repr__
    table, overflow = _vis_overflow(self.table, self.limit)
  File ".../petl/petl/util/", line 528, in _vis_overflow
    table = list(islice(table, 0, limit+2))
  File ".../petl/petl/io/", line 45, in __iter__
    for row in reader:
  File "...with/petl/petl/io/", line 150, in next
    return [unicode(s, 'utf-8') for s in row]
TypeError: coercing to Unicode: need string or buffer, float found

Without the quoting petl converts numbers to strings, but I need to preserve the type of data values.

@alimanfoo alimanfoo referenced this issue May 31, 2016


resolves #377 #378

@alimanfoo alimanfoo closed this in 7bd1719 Oct 25, 2016

alimanfoo added a commit that referenced this issue Oct 25, 2016

@alimanfoo alimanfoo added this to the v1.2 milestone Dec 15, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment