Recall & Review
beginner
What does adding two columns in a pandas DataFrame do?
It adds the values in each row from the two columns and creates a new column with these sums.
Click to reveal answer
beginner
How do you subtract one column from another in pandas?
You use the minus (-) operator between the two columns, like df['col1'] - df['col2'].
Click to reveal answer
beginner
What happens if you multiply a column by a number in pandas?
Each value in the column is multiplied by that number, scaling the entire column.
Click to reveal answer
beginner
How can you create a new column that is the result of dividing one column by another?
Use the division operator (/) between the two columns, like df['col1'] / df['col2'].
Click to reveal answer
beginner
Why is it useful to perform arithmetic operations on DataFrame columns?
It helps to create new insights or features by combining or transforming existing data easily.
Click to reveal answer
What does df['A'] + df['B'] do in pandas?
✗ Incorrect
Adding two columns sums their values for each row.
How do you multiply all values in column 'X' by 10?
✗ Incorrect
Multiplying a column by 10 scales each value by 10.
Which operator divides one column by another in pandas?
✗ Incorrect
The division operator (/) divides values of one column by another.
What will df['C'] = df['A'] - df['B'] do?
✗ Incorrect
Subtracting columns creates a new column with their difference.
Why perform arithmetic on DataFrame columns?
✗ Incorrect
Arithmetic operations help generate new useful data from existing columns.
Explain how to add two columns in a pandas DataFrame and why you might do this.
Think about combining data from two columns to get a total.
You got /4 concepts.
Describe how to multiply a DataFrame column by a number and what effect this has on the data.
Consider how changing each value by a fixed number changes the data.
You got /4 concepts.