Thanks to visit codestin.com
Credit goes to github.com

Skip to content

record array: passing formats as tuple raises error (Trac #1139) #1737

@thouis

Description

@thouis

Original ticket http://projects.scipy.org/numpy/ticket/1139 on 2009-06-17 by @huard, assigned to unknown.

If a tuple is passed to the formats argument to rec.fromarrays for example, the following error is raised:

/usr/local/lib/python2.5/site-packages/numpy-1.4.0.dev7045-py2.5-linux-x86_64.egg/numpy/core/records.pyc in fromarrays(arrayList, dtype, shape, formats, names, titles, aligned, byteorder)
    506         _names = descr.names
    507     else:
--> 508         parsed = format_parser(formats, names, titles, aligned, byteorder)
    509         _names = parsed._names
    510         descr = parsed._descr

/usr/local/lib/python2.5/site-packages/numpy-1.4.0.dev7045-py2.5-linux-x86_64.egg/numpy/core/records.pyc in __init__(self, formats, names, titles, aligned, byteorder)
    110     """
    111     def __init__(self, formats, names, titles, aligned=False, byteorder=None):
--> 112         self._parseFormats(formats, aligned)
    113         self._setfieldnames(names, titles)
    114         self._createdescr(byteorder)

/usr/local/lib/python2.5/site-packages/numpy-1.4.0.dev7045-py2.5-linux-x86_64.egg/numpy/core/records.pyc in _parseFormats(self, formats, aligned)
    124                 formats.append('')
    125             formats = ','.join(formats)
--> 126         dtype = sb.dtype(formats, aligned)
    127         fields = dtype.fields
    128         if fields is None:

TypeError: data type not understood
WARNING: Failure executing file: <load.py>

If the tuple is converted into a list, then everything works fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions