pandas replace % with calculated
def FormatPerc(x): # Create the function to be applied
perc = 0
x = str(x)
if '%' in x:
x = x.replace("%","")
perc = float(x)*0.001
else:
x = x.replace("%","")
perc = float(x)
return perc
# in your pandas script:
investments['WithdrawPercentage'] = investments['WithdrawPercentage'].apply(FormatPerc)
# any values like "xx.x%" will now be formatted as 0.xxx