[SciPy-User] Possible to access value in a Two-dimensional recorded array ?

Troels Emtekær Linnet tlinnet@gmail....
Mon Apr 22 11:47:03 CDT 2013


Does there exist a numpy recorded array, too access values row keys,
so you can combine row and column keys?
Now I am making a search for the value, but I guess that could be smarter?

import os
import numpy as np


# data.txt
#dat1 ../0plane.proc/test.ft2 peaks.list 0.06 28 466.667
#dat2 ../1plane.proc/test.ft2 peaks.list 0.06 0 0.000

fl = np.recfromtxt("data.txt", names="name, ftfile, peakfile, timeT2, NI,
print fl['ftfile']
print fl[1]['name']
print fl[0]
#print fl['dat1'] # ValueError: field named dat1 not found.
l = 'dat2'
s = np.where(l==fl['name'])
print fl[s]['NI']

Troels Emtekær Linnet
Ved kløvermarken 9, 1.th
2300 København S
Mobil: +45 60210234
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20130422/581ccd28/attachment-0001.html 

More information about the SciPy-User mailing list