'Convert object field to date and the also the display format of the date

I Have a Dataframe with 2 columns Object like that:

id                  object
date                object

+------+-----------------+  
|  ID  |      DATE       |
+------+-----------------+
|   1      01/10/2000    |
|   2      09/03/2005    |
|   3    1 January 2020  |
|   4     "21/08/1995"   |
|   5     27 April 2020  |
+------------------------+

I would like to convert the dates in the same format dd/mm/yyyy

I tried to use

df["DATE"] = pd.to_datetime(df["DATE"]) 

     

and this

df['DATE'].astype("datetime")

But i got this errpr : TypeError: data type 'datetime' not understood

Can you help me please ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source