How to convert miliseconds to datetime with format: mm:ss:msmsms (minutes:seconds:miliseconds) without year , month an day [duplicate]

How to convert miliseconds to datetime with format: mm:ss:msmsms (minutes:seconds:miliseconds) without year , month an day [duplicate]



This question already has an answer here:



Is there a simple way to convert milliseconds in a dataframe to a datetime without year, month and day?



I have successfully converted a column of milliseconds to datetime. However, I want to get rid of the year, months and days.



I did this:


df['Laptimes'] = pd.to_datetime(df['milliseconds'], unit='ms')



But my values are now formatted as: "1970-01-01 00:01:38.109".


"1970-01-01 00:01:38.109"



I want to have: "01:38:109"


"01:38:109"



This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





docs.python.org/2/library/datetime.html#datetime.date.strftime and docs.python.org/2/library/…
– Joe
Aug 21 at 13:22





1 Answer
1



Just call the time() method on the datetime object:


df['Laptimes'].time()

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

PHP code is not being executed, instead code shows on the page

Malaysia to Papua New Guinea by motorcycle?