I have a data frame like this:
BuyTime ID SellTime
94650 1 94651
94717 1 94817
120458 2 114119
the buy time and sell time type are integer but i want to convert them to standard time date. I already used
quote['SellTime'] = pd.to_datetime(quote['SellTime'], unit = 's')
but it gives a start year like 1970-01-01 to time which is not needed. my data should be like this:
BuyTime Id SellTime
09:46:50 1 09:46:51
09:47:17 1 09:48:17
12:04:58 2 11:41:19
EDIT: also using this function regard to size of my data is not efficient:
def format_time(value):
t2 = str(value)
if len(t2) == 5:
return "0%s:%s:%s" % (t2[0], t2[1:3], t2[3:5])
return "%s:%s:%s" % (t2[0:2], t2[2:4], t2[4:6])