I'm learning Pandas through a tutorial on Kaggle. On this page, the following example appears (review_points is a DataFrame): review_points_mean = reviews.points.mean() reviews.points.map(lambda p: p - review_points_mean) def remean_points(row): row.points = row.points - review_points_mean return row reviews.apply(remean_points, axis='columns') I see that the function remean_code mutates the row it takes as input (in addition to returning it). However, on Pandas docs (see this page), there is the following note regarding DataFrame.apply: Functions that mutate the passed object can produce unexpected behavior or errors and are not supported. See Mutating with User Defined Function (UDF) methods for more details. The example on this Pandas docs page is of a function which removes an element from the row (rather than just change an element). I am new to Pandas, and so I suspect I might not understand the situation correctly. Is the remean_points function from the Kaggle tutorial supported by Pandas, even though it does change the argument row? Is the remean_points function not officially allowed by Pandas, but works with the present implementation of DataFrame because it only changes an element of the row? Maybe the situation is none of the previous two, and there's just something I don't understand correctly? The example in the Kaggle tutorial works. I tried it. The question is whether this implementation of remean_points is likely to work with future versions of Pandas, and whether it is the recommended way to work with DataFrame.apply when we only need to change a value (another way would be to make a copy of row before changing it). Continue reading...