方法一:
def seconds_to_hms(seconds_num):
"""
輸入秒數 轉換為 時分秒輸出
param: seconds_num integer 666
return: hms str 00:00:00
"""
m, s = divmod(seconds_num, 60)
h, m = divmod(m, 60)
hms = "%02d:%02d:%02d" % (h, m, s)
return hms
#divmod() 函數求出兩個整數的商和余數
#divmod(a,b) 函數的作用返回一個包含商和余數的元組(a // b, a % b),
方法二:strftime('%H:%M:%S',gmtime(x))
df['時長'].map(lambda x:strftime('%H:%M:%S',gmtime(x)))