From a df column 'Desc' I want to extract substrings that start with n or N followed by a digit, here's a test df with my code and result:
import pandas as pd
testdf = pd.DataFrame({'Desc': ['n1.2A Full Version', 'N5.0.0 Bridge', 'N5.35A Automatic', 'n2 Bridge']})
testdf['Version'] = testdf['Desc'].str.extract(r'([nN]\d.+?[\s])', expand=False)
How to fix the regex so that it doesn't show NaN for the last record? Thanks
