I want to learn how to use lambdas with this type of setting without using a for loop which a function takes arguments from rows of two columns of the dataframe and write the result to another column.
import pandas as pd
df = pd.DataFrame({"A": [1,2,3], "B": [2,3,4]})
print(df)
df["C"] = ""
print(df)
def add_num(num1 ,num2):
return num1 + num2
for i in range(len(df)):
df["C"][i] = add_num(df["A"][i], df["B"][i])
print(df)