I am using an apply method to determine the values for the three columns I am trying to create. The function that is responsible for calculating is calculate
. It gives back the three values that are needed. The problem is how do I assign those three values to the columns. I tried doing something like this
def calculate(row):
return 'column1_value', 'column2_value', 'column3_value'
df[['column1', 'column2', 'column3']] = df.apply(lambda row: calculate(row), axis=1)
That did not work, but is there a way that would allow assigning multiple values to multiple columns at once?