[Numpy-discussion] A question about dtype syntax

Marquette Jean-Baptiste marquett at iap.fr
Tue Aug 30 04:46:24 EDT 2011


Hi all,

I have this piece of code:

Stats = [CatBase, round(stats.mean(Data.Ra), 5), round(stats.mean(Data.Dec), 5), len(Sep), round(stats.mean(Sep),4), round(stats.stdev(Sep),4)]
print Stats
if First:
	StatsAll = np.array(np.asarray(Stats), dtype=('a11, f8, f8, i4, f8, f8'))
        First = False
else: 
        StatsAll = np.vstack((StatsAll, np.asarray(Stats)))
        print len(StatsAll)

This yields the error:

['bs3000k.cat', 280.60341, -7.09118, 9480, 0.2057, 0.14]
Traceback (most recent call last):
  File "/Users/marquett/workspace/Distort/src/StatsSep.py", line 40, in <module>
    StatsAll = np.array(np.asarray(Stats), dtype=('a11, f8, f8, i4, f8, f8'))
ValueError: could not convert string to float: bs3000k.cat

What's wrong ?
Thanks for your help

Cheers
JB

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110830/0e2b96ac/attachment.html>


More information about the NumPy-Discussion mailing list