I am updating a data frame using apply of function.
But now I need to modify multiple columns using this function,
Here is my sample code:
def update_row(row):
listy = [1,2,3]
return listy
dp_data_df[['A', 'P','Y']] = dp_data_df.apply(update_row, axis=1)
It is throwing the following error:
ValueError: shape mismatch: value array of shape (10,) could not be broadcast to indexing result of shape (3,10)
Thanks in advance.