I am using the transform() function on a simple dataframe to achieve two purposes:
- I want to create the same number of columns (with the same names) as rows.
- I want to create a column named “Total” which adds up the numbers in all the columns for each row.
The screenshot below shows the dataframe and the error message I received:
If I apply the same function which already satisfied condition 1 from above, there is no error message: