Convert Unix timestamps to datetime in Pandas with pd.to_datetime

Convert Unix timestamps to datetime in Pandas with pd.to_datetime

Want to convert an integer Python Pandas column from Unix time to datetime?

Use pd.to_datetime, passing the int column and the “unit” keyword argument, set to “s” (seconds):

df['date'] = pd.to_datetime(df['unixtime'],unit='s')

If the column is in ms, then say unit=’ms’