Extract date from datetime in Pandas column

use .dt.date

df[‘column’] = pd.to_datetime(df[‘column’], format=’%Y-%m-%d’).dt.date

Source-

https://stackoverflow.com/questions/16176996/keep-only-date-part-when-using-pandas-to-datetime

Unknown's avatar

Author: Ajay Ohri

http://about.me/ajayohri

Leave a comment