0

I'm reading a date column from excel into pandas. The column seems to have mixed date formats e.g.: What is the cleanest way to read these values as mm/dd/yyyy?

patientdob
1/25/1938
12/14/1961
8/23/2002
10/30/1951
11/22/1968
12-05-1972
2/18/2008
01-07-2001
4/26/1972
2/20/1994
10/18/1970
09-07-1954
10/20/1965
03-03-1946

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
PriyankaJ
  • 339
  • 4
  • 19
  • `df['patientdob'] = pd.to_datetime(df['patientdob'])` ? – jezrael Apr 03 '20 at 09:50
  • Thanks @jezrael, this reads the dates in format mm/dd/yyyy correctly but for those in format mm-dd-yyyy are read as dd-mm-yyyy. How do I avoid that? – PriyankaJ Apr 03 '20 at 15:00

0 Answers0