Answers for "epoch to date python df"

0

convert epoch time to date python pandas

import pandas as pd
df = pd.DataFrame({1349876543,1349865757,1349867849,1349880000}, columns={"epoch_time"})
df
   epoch_time
0  1349880000
1  1349867849
2  1349865757
3  1349876543

df["date_time"] = pd.to_datetime(df["epoch_time"], unit='s')
df
   epoch_time           date_time
0  1349880000 2012-10-10 14:40:00
1  1349867849 2012-10-10 11:17:29
2  1349865757 2012-10-10 10:42:37
3  1349876543 2012-10-10 13:42:23
Posted by: Guest on August-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language