I need to create new column in pandas dataframe.
df
Id Value
1 >45%
2 >29%
3 <30 to >69
4 >40% to <56%
5 --
df_output:
Id Value Value2
1 >45% 45%
2 >29% 29%
3 <30 to >69 69
4 >40% to <56% 56%
5 -- NaN
In my Dataframe there is column called Value, i need to create new column"Value2" on top that column. In Value2 column i need only one number with suffix (if exist in value column) based on the value column.if there are multiple numbers like Id 3&4, i need the highest one among them.
I tried:
df.Value.str.extract('(\d+)')
But it only extracts the numbers.