I would like to extract the number out of a column and replace the initial column by the numbers. Thanks for any help.
code:
d = {'col1': [1, 2, 3, 4], 'col2': ['3 A', '4', '7 B', '9F']}
df = pd.DataFrame(data=d)
print(df)
output:
col1 col2
0 1 3 A
1 2 4
2 3 7 B
3 4 9F
desired output:
col1 col2
0 1 3
1 2 4
2 3 7
3 4 9