Preparing DF for the same as yours:
df = pd.DataFrame({'A': [1, 3, 1, 2, 3], 'B' : ['V2', 'W42', 'S03', 'T02', 'U71']})
df.head()
Now manipulate it to get the desired result:
df['C'] = df['B'].apply(lambda x: re.search(r'\d+', x).group())
df.head()
A B C
0 1 V2 2
1 3 W42 42
2 1 S03 03
3 2 T02 02
4 3 U71 71
source
share