[Tutor] genfromtx- date and time conversions

Ek Esawi esawiek at gmail.com
Sat Feb 13 22:53:04 EST 2016


I am using genfromtxt to read a csv file with data types that include
string, float, integer, date, and time. I was able to accomplish such a
task using reader.


I thought there might be easier ways and the one I thought about is
genfromtxt. I have 2 questions: (1) Is there a function (method) to convert
time in H:M:S, format, e.g. 12:30:30 to decimal or 24 format e.g.12.508 w/o
writing my own function to convert it ? (2) Given a date of the form
12/20/2005, can such date in such format be converted with converters in
numpy using datetime to ‘2005-20-15’? I had to reformat the date on my csv
file to the later form for python to read it correctly.



Thanks-EKE


More information about the Tutor mailing list