I have a data frame with a column with values in millisecond time stamp.(df['Millisecond']
)
What I want to do is to convert all values of that column into normal dates. Ex. 2017-04-27 04:55:00
You need python's datetime package to do that:
import datetime
date = datetime.datetime.fromtimestamp(milliseconds/1000.0)
date = date.strftime('%Y-%m-%d %H:%M:%S')
you can do this by using to_datetime function https://pandas.pydata.org/docs/reference/api/pandas.to_datetime.html.
df['Millisecond'] = pd.to_datetime(df['Millisecond'], unit='ms')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With