>>> import pandas as pd >>> >>> df = pd.DataFrame(['1/2/2020','12/31/2020','20-Jun-20'],columns=['Date']) >>> df Date 0 1/2/2020 1 12/31/2020 2 20-Jun-20 >>> >>> df['Date'] = pd.to_datetime(df['Date']) >>> df Date 0 2020-01-02 1 2020-12-31 2 2020-06-20 >>> >>> df['Date'] = pd.to_datetime(df['Date']).dt.strftime('%y-%m-%d') >>> >>> df Date 0 20-01-02 1 20-12-31 2 20-06-20 >>>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter