def revised_price(engine-location,price): if engine-location==front: updated_price== price else: updated_price== 2*price
return new_profit
df[‘updated_price’] = df.apply(lambda x: revised_price(x[‘engine-location’], x[‘price’]),axis=1)
Please find the error that i am getting File “”, line 1 def revised_price(engine-location,’price): ^ SyntaxError: invalid syntax
Advertisement
Answer
You didn’t follow naming convention here
You can’t name inside a function like engine-location , instead rename it to engine_location, and also instead of
updated_price == price
try
updated_price = price
and instead of
updated_price == 2*price
use
updated_price = 2*price