Lets say I have a dataframe df
as
A B
1 V2
3 W42
1 S03
2 T02
3 U71
I want to have a new column (either at it the end of df
or replace column B
with it, as it doesn't matter) that only extracts the int from the column B
. That is I want column C
to look like
C
2
42
3
2
71
So if there is a 0 in front of the number, such as for 03, then I want to return 3 not 03
How can I do this?