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

Kathleen M Tacina Kathleen.M.Tacina at nasa.gov
Mon Dec 13 16:39:20 EST 2010


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__
>>> 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.
>>> data = np.ndarray((5,1),dtype=[(('T at 0.25-in in F','T'),float)])

Would it be possible to change the tests to allow the name and title to
be the same for the same component? 

I can work around this new limitation for new data files, but I'm having
trouble reading data files I created last winter.  

(But even for new stuff, it would be nice if it name=title was allowed.
I like using both names and titles so that I can record interesting
information like point location and units in the titles.  Sometimes,
though, there isn't anything else interesting to say about a column
(e.g., 'point','date', 'time'), and I'd like to (1) have both a title
and a name to be consistent with more interesting columns and (2) have
the title be equal to the name.)

Thanks for any help you can give me with this!
Kathy Tacina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20101213/a202c23f/attachment.html>

More information about the NumPy-Discussion mailing list