Question1
I'm trying to let a dataframe columns add the same number.
Trying use apply to make columns add a number.
First define a function call 'apply_age'
def apply_age(x,bias):
return x+bias
data["age"] = data["age"].apply(apply_age,args=(50,))
#it can work
but
def apply_age(x,bias):
return x+bias
data["age"] = data["age"].apply(apply_age,args=(,50))
#it can't work,and show SyntaxError: invalid syntax
Question2
Why type 2 number in each site will get error ?
Which is 'TypeError: apply_age() takes 2 positional arguments but 3 were given def apply_age(x,bias)'
data["age"] = data["age"].apply(apply_age,args=(50,2))