How do you apply a function element-wise to a column in a DataFrame?

Instruction: Demonstrate the use of the 'apply' method to transform the data of a column in Pandas.

Context: This question assesses the candidate's familiarity with data transformation techniques in Pandas, crucial for feature manipulation and data cleaning.

Updated

Official answer available

Read the opening below, then unlock the full answer and practical guidance.

For example, let's say we have a DataFrame df with a column age that contains the ages of users in years...

Related Questions