xxxxxxxxxx
import pandas as pd
def sum(x, y, z, m):
return (x + y + z) * m
df = pd.DataFrame({'A': [1, 2], 'B': [10, 20]})
df1 = df.apply(sum, args=(1, 2), m=10)
print(df1)
xxxxxxxxxx
# to Add a lambda function which will increase the entry in each column by 3
df["column_name"] = df["column_name"].apply(lambda x:x+3)
Eg: df["MPG_City"] = df["MPG_City"].apply(lambda x: x+3)