I am trying to use the str.extract(\'(\\d+)\') method on a pandas series to get the digits of a phone number that looks like: (123) 456-7890
Using this method only r
df = pd.DataFrame({'no': ['(123) 456-7890', '+321 / 555-7890']}) df['clean'] = df.no.str.extractall('(\d+)').unstack().apply(''.join, axis=1)
Result:
no clean 0 (123) 456-7890 1234567890 1 +321 / 555-7890 3215557890