I need to extract the dates from a series of strings like this:
'MIHAI MĂD2Ă3.07.1958'
or
'CLAUDIU-MIHAI17.12.1999'
How to do this?
Tried this:
for index,row in DF.iterrows():
try:
if math.isnan(row['Data_Nasterii']):
match = re.search(r'\d{2}.\d{2}.\d{4}', row['Prenume'])
date = datetime.strptime(match.group(), '%d.%m.%Y').date()
s = datetime.strftime(datetime.strptime(str(date), '%Y-%m-%d'), '%d-%m-%Y')
row['Data_Nasterii'] = s
except TypeError:
pass