Adding and Changing Columns
Assign to a new column name to create it, using maths on other columns. assign does the same and returns a new DataFrame. For text, the .str methods work on a whole column at once. np.where or apply can pick values by rule.
Examplepython
Quick check
What does `df['total'] = df['price'] * df['qty']` do?
Your turn: write the code
Add a column called months that is age * 12, then print the DataFrame.
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.