Turn dataframe column into hours, minutes and seconds

Asked

Viewed 45 times

0

I’m having trouble turning a numeric integer column that is in seconds to the format of

hours:minutes:seconds

, for example:

df = pd.DataFrame(np.random.randint(900,4000,size=(10000, 1)), columns=list('A'))      

How could I turn this whole df?

1 answer

0


You can use the to_timedelta method()

df["A"] = pd.to_timedelta(df["A"], unit="S")

Browser other questions tagged

You are not signed in. Login or sign up in order to post.