How can I replace the values of an existing dataframe column with the values from the re.search loop?
This is my re.search loop.
for i in dataset['col1']:
clean = re.search('(nan|[0-9]{1,4})([,.][0-9]{1,4})?', i)
print(clean.group())
This is the sample data set (dataset)
year col1
1 2001 10.563\D
2 2002 9.540\A
3 2003 4.674\G
4 2004 3.2754\u
5 2005 nan\x