Skip to content

Instantly share code, notes, and snippets.

@joonro
Last active June 23, 2018 21:23
Show Gist options
  • Save joonro/e9a116056612403302dc9e183a1b16e4 to your computer and use it in GitHub Desktop.
Save joonro/e9a116056612403302dc9e183a1b16e4 to your computer and use it in GitHub Desktop.
[Covert Date in Int to pd.Timestamp] #python #pandas #date #time
import pandas as pd
# convert to datetime
showdates = pd.to_datetime(con_df['showdate'].astype(str))
# if you don't do `to_timedelta`, you will get integer numbers
# so convert it back to timedelta
pd.to_timedelta(showdates.values[1:] - showdates.values[:-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment