In the following code I want to get just the digits between '-' and 'u'. I thought i could apply regular expression non capturing groups format (?: … ) to ignore everything from '-' to the first digit. But output always include it. How can i use noncapturing groups format to generate correct ouput?
df = pd.DataFrame(
{'a' : [1,2,3,4],
'b' : ['41u -428u', '31u - 68u', '11u - 58u', '21u - 318u']
})
df['b'].str.extract('((?:-[ ]*)[0-9]*)', expand=True)