[Tutor] Retrieving data from a text file

Debashish Saha silideba at gmail.com
Tue Apr 9 23:23:21 CEST 2013


In the following you can see data from a ephemeris.txt file. Now I want to
retrieve several columns(say, for example the column starting with 00:00,
27.69 and 44.1) and name the array as x,y,z. What do I have to I tried this

x, y, z = numpy.loadtxt("ephemeris.txt", unpack=True)
And  got this error

"ValueError: could not convert string to float: Date__(UT)__HR:MN"
Could you also help me in converting that HR:MN into minute only?

Date__(UT)__HR:MN     R.A.__(a-apparent)__DEC\
**********************************************\
 2013-Jan-01 00:00 *   14 31 27.69 -12 29 44.1\
 2013-Jan-01 00:01 *   14 31 27.71 -12 29 44.1\
 2013-Jan-01 00:02 *   14 31 27.72 -12 29 44.2\
 2013-Jan-01 00:03 *   14 31 27.73 -12 29 44.2\
 2013-Jan-01 00:04 *   14 31 27.75 -12 29 44.3\
 2013-Jan-01 00:05 *   14 31 27.76 -12 29 44.3\
 2013-Jan-01 00:06 *   14 31 27.77 -12 29 44.4\
 2013-Jan-01 00:07 *   14 31 27.78 -12 29 44.4\
 2013-Jan-01 00:08 *   14 31 27.80 -12 29 44.4\
 2013-Jan-01 00:09 *   14 31 27.81 -12 29 44.5\p
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130410/7ca76a17/attachment-0001.html>


More information about the Tutor mailing list