# importing pandas package import pandas as pd #date to datetime df['Dates'] = pd.to_datetime(df['Dates'], format='%Y%m%d')