[Numpy-discussion] same name and title in structured arrays

Pauli Virtanen pav at iki.fi
Mon Dec 20 07:15:17 EST 2010

On Mon, 13 Dec 2010 16:39:20 -0500, Kathleen M Tacina wrote:
> I've been finding numpy/scipy/matplotlib a very useful tool for data
> analysis.  However, a recent change has caused me some problems.
> Numpy used to allow the name and title of a column of a structured array
> or recarray to be the same (at least in the svn version as of early last
> winter).  Now, it seems that this is not allowed; see below.
> Python 2.6.5 (r265:79063, Apr 27 2010, 12:20:23) [GCC 4.2.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import numpy as np
>>>> np.__version__
> '2.0.0.dev-799179d'
>>>> data = np.ndarray((5,1),dtype=[(('T','T'),float)])
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ValueError: title already used as a name or title.

This behavior was changed when fixing #1254:


It seems that it will not be possible to just revert to the old behavior, 
since apparently allowing that was a design mistake.

The data loading routines however could in principle be changed to handle 
duplicate title/field combinations. How did you save your data, with 
numpy.save/numpy.savez or via pickling?

Pauli Virtanen

More information about the NumPy-Discussion mailing list