Search code examples
pythontimestampmilliseconds

How to convert millisecond time stamp to normal date in Python?


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


Solution

  • 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')