[Numpy-discussion] numpy loadtxt - ValueError: setting an array element with a sequence.

TheLonelyStar nabble2 at lonely-star.org
Thu Oct 29 07:19:05 EDT 2009


Hi,

I am trying to load a tsv file using numpy.loadtxt:

data = np.loadtxt('data.txt',delimiter='\t',dtype=np.float)

And I get:
-----------------
/usr/lib/python2.6/site-packages/numpy/lib/io.pyc in loadtxt(fname, dtype,
comments, delimiter, converters, skiprows, usecols, unpack)
    503         X = X.view(dtype)
    504     else:
--> 505         X = np.array(X, dtype)
    506 
    507     X = np.squeeze(X)

ValueError: setting an array element with a sequence.
> /usr/lib/python2.6/site-packages/numpy/lib/io.py(505)loadtxt()
    504     else:
--> 505         X = np.array(X, dtype)
    506 
----------------

I am on archlinux using 1.3.0. The file contians integers and floats
sperated by tabs.

Ideas?

Thanks!
Nathan
-- 
View this message in context: http://www.nabble.com/numpy-loadtxt---ValueError%3A-setting-an-array-element-with-a-sequence.-tp26111151p26111151.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.




More information about the NumPy-Discussion mailing list