[NumPy-Tickets] [NumPy] #1936: loadtxt with nested dtype fails with "ValueError: setting an array element with a sequence"
NumPy Trac
numpy-tickets@scipy....
Tue Aug 16 10:38:11 CDT 2011
#1936: loadtxt with nested dtype fails with "ValueError: setting an array element
with a sequence"
--------------------+-------------------------------------------------------
Reporter: gerrit | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: Other | Version: devel
Keywords: |
--------------------+-------------------------------------------------------
I'm sure this used to work. It also works for someone else on IRC.
{{{
$ python
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import loadtxt, uint8
>>> from StringIO import StringIO
>>> from numpy.version import version
>>> print version
2.0.0.dev-5cf0a07
>>> loadtxt(StringIO("0 1 2 3"), dtype=[("a", uint8, 2), ("b", uint8, 2)])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/storage4/home/gerrit/.local/lib/python2.6/site-
packages/numpy/lib/npyio.py", line 806, in loadtxt
X = np.array(X, dtype)
ValueError: setting an array element with a sequence.
>>> loadtxt(StringIO("0 1 2 3"), dtype=[("a", uint8, 4)])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/storage4/home/gerrit/.local/lib/python2.6/site-
packages/numpy/lib/npyio.py", line 806, in loadtxt
X = np.array(X, dtype)
ValueError: setting an array element with a sequence.
}}}
What's going on here?
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1936>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list