I wrote this function to clean the + and , out of a column:
def data_clean_installs(x):
if '+' in x:
return float(x.replace('+',''))
elif ',' in x:
return float(x.replace(',',''))
else:
return float(x)
I want to use the function to make a new int column called 'Clean_Installs' and ran this:
apr['Clean_Installs'] = apr.Installs.astype('str').apply(data_clean_installs).apply(int)
and get this ValueError: could not convert string to float: '10,000'
I tried everything I can think of, too much to put here and will take any inputs please... Oh, I am new and this is my first question ever. Sorry if I violated any rules... Really hope someone can help. Thanks!