My time data set is stored in the variable time = [0., 0.08333333, 0.16666667, 0.25, 0.33333333, 0.41666667, 0.5, 0.58333333, 0.66666667, 0.75, 0.83333333, 0.91666667, 1., 08333333, 1.16666667] p>
Can anyone tell me if there is a simple way to convert this to the format hh: mm: ss?
I tried to create a function, but it is giving error:
import datetime as dt
from datetime import timedelta
def time2dt(time):
seconds = int(time*60*60)
minutes, seconds = int(divmod(seconds, 60))
hours, minutes = int(divmod(minutes, 60))
return dt.datetime(hours, minutes, seconds) + dt.timedelta(time % 1)
dates = [time2dt(time[i]) for i in np.arange(len(time))]
datestr = [i.strftime('%H:%M:%S') for i in dates]
TypeError: int () argument must be a string or a number, not 'tuple'