Data looks like:
x = ['Range: $1,430,000 - $1,670,000', 'Range: $20,000 - $30,000', '$160,000']
though many more values. I am trying to remove all text and characters aside from numerical and average the numbers when there is a range. I have tried
x = x.astype(str).str.replace("$", "")
x = x.str.replace(",", "")
x = x.str.replace(" -", "").astype(int)
This removes all the text and characters but I don't know how to replace the 2 numbers in a range with the average of the 2 numbers.
I would like the data to end up as:
x = ['1550000', '25000', '160000']
Thanks for your help.