I have a dataframe (df):
df = pd.DataFrame({'A' : [54321, 'it is 54322', 'is it 54323 or 4?', np.NaN]})
I can find the numbers in it:
df['B'] = df.A.replace(regex={'[^\w]':'','^\D+':'','\D+':' '}).str.split('\s')
A B
0 54321 NaN
1 it is 54322 [54322]
2 is it 54323 or 4? [54323, 4]
3 NaN NaN
But when I try to find the highest number for each row:
df['C'] = df['B'].apply(lambda x : max(x))
I get:
TypeError: 'float' object is not iterable