In my dataset, i have a feature (called Size
) like this one:
import pandas as pd
dit={"Size" : ["0","0","5mm","12-15","3-10"] }
dt = pd.DataFrame(data=dit)
This feature specifies a size in a range (with minimum and maximum) or by a specific number.
Now, i wish to replace the values by the Maximum of each range.
So, in my example the output should be
dit={"Size" : ["0","0","5mm","15mm","10mm"] }
This is what i have tried:
import re
dt = re.split("-",dt.loc[:,"Size"])
But, it complains with:
TypeError: expected string or bytes-like object
and this is makes sense because the type of dt.loc[:," Size (in mm)"]
is:
pandas.core.series.Series
My question is, how can i simply update this column without a loop?