I need to normalize my columns using the formula:
x/total * 100
I created my custom function here:
def normalize(df):
result=[]
total= df[col].sum()
for value in df[col]:
result.append(value/total *100)
return result
applying the function here. I get TypeError: normalize() got an unexpected keyword argument 'axis'
df['columnname'].apply(normalize, axis=1)
Please how could I do this? Or/and is there a more efficient way of doing this? Thanks