[Numpy-discussion] Simple Loadtxt question

Robert Love rblove_lists@comcast....
Wed Nov 28 18:21:08 CST 2012


I have a file with thousands of lines like this:

Signal was returned in 204 microseconds
Signal was returned in 184 microseconds
Signal was returned in 199 microseconds
Signal was returned in 4274 microseconds
Signal was returned in 202 microseconds
Signal was returned in 189 microseconds

I try to read it like this:


data = np.loadtxt('dummy.data', dtype={'names':('label','times','musec'), 'fmts':('|S23','i8','|S13')})

It fails, I think, because it wants a string format and field for each of the words 'Signal' 'was' 'returned' etc.

Can I make it treat that whole string before the number as one string, one field?  All I really care about is the numbers anyway.

Any advice appreciated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20121128/d2f0912f/attachment.html 


More information about the NumPy-Discussion mailing list