petl-developers / petlx

Optional extensions for petl based on third party libraries.
MIT License
44 stars 9 forks source link

Attempting to use petlx.array.toarray causes ValueError #64

Closed tikibug closed 10 years ago

tikibug commented 10 years ago

This is with Python 2.6, NumPy 1.7

Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/site-packages/petlx/array.py", line 134, in toarray sa = np.fromiter(it, dtype=dtype, count=count) ValueError: cannot create object arrays from iterator

alimanfoo commented 10 years ago

Thanks, will look into it.

On Mon, Jul 21, 2014 at 9:48 PM, tikibug notifications@github.com wrote:

This is with Python 2.6, NumPy 1.7

Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/site-packages/petlx/array.py", line 134, in toarray sa = np.fromiter(it, dtype=dtype, count=count) ValueError: cannot create object arrays from iterator

Reply to this email directly or view it on GitHub https://github.com/alimanfoo/petlx/issues/64.

Alistair Miles Head of Epidemiological Informatics Centre for Genomics and Global Health http://cggh.org The Wellcome Trust Centre for Human Genetics Roosevelt Drive Oxford OX3 7BN United Kingdom Web: http://purl.org/net/aliman Email: alimanfoo@gmail.com Tel: +44 (0)1865 287721

alimanfoo commented 10 years ago

Apologies for very slow response on this. I suspect some values of the input table are Python objects (e.g., lists or something else), unfortunately numpy does not support object dtype when loading from an iterator.

As a workaround try loading into a pandas dataframe, see petlx.dataframe.

alimanfoo commented 10 years ago

Will close for now but feel free to reopen if you think there is a way to resolve directly.