In python 3.6.0 and pandas 0.20.0
there is a date column yyyy-mm-dd
date
2017-08-16
2017-08-17
2017-08-18
There is the same question here
Convert a column of datetimes to epoch in Python
But sadly none of the solutions in the post works
df['date']=df['date'].astype('int64')//1e9
ValueError: invalid literal for int() with base 10: '2017-08-16'
df['date']=(df['date'] - dt.datetime(1970,1,1)).dt.total_seconds()
NameError: name 'dt' is not defined
Any thoughts? Thank you.