Creating arrays with 'titles' in dtype causes TypeError on data access
Hi, I'm trying to use the additional 'title' feature of dtypes when creating arrays. The reason for using titles is that I want to store meta data about the columns in them (so do-not-use-titles is not the right solution for me...) Everything works fine without titles:
arr = array([('john', 4),('mark', 3)], dtype=[('name','O'),('id',int)]) arr[0] ('john', 4) arr[0][0] 'john'
However here something is strange:
arr = array([('john', 4),('mark', 3)], dtype=[(('source:yy', 'name'),'O'),(('source:xx','id'),int)]) arr[0] ('john', 4) arr[0][0] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: function takes at most 2 arguments (3 given)
Any ideas what I'm doing wrong? Any help would be appreciated. Thanks, Ralph Using: - Python V 2.6 (but same error with python 2.5) - Numpy 1.2.1 (but same error on numpy 1.0.3.1) - opensuse 10.3
Ralph Heinkel wrote:
However here something is strange:
arr = array([('john', 4),('mark', 3)],
dtype=[(('source:yy', 'name'),'O'),(('source:xx','id'),int)])
arr[0]
('john', 4)
arr[0][0]
Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: function takes at most 2 arguments (3 given)
Any ideas what I'm doing wrong? Any help would be appreciated.
This is a bug in NumPy. I will fix it in the trunk tonight. -Travis -- Travis Oliphant Enthought, Inc. (512) 536-1057 (office) (512) 536-1059 (fax) http://www.enthought.com oliphant@enthought.com
participants (2)
-
Ralph Heinkel -
Travis E. Oliphant