Complete the code to import the numpy library for log transformation.
import [1] as np
We use numpy for numerical operations including log transformation.
Complete the code to apply log transformation to the 'Income' column in the DataFrame 'df'.
df['log_income'] = np.[1](df['Income'])
The np.log function applies the natural logarithm to data, useful for reducing skewness.
Fix the error in the code to avoid log of zero or negative values by adding 1 before log transformation.
df['log_sales'] = np.log(df['Sales'] [1] 1)
Adding 1 before log avoids errors from zero or negative values.
Fill both blanks to create a dictionary comprehension that maps words to their lengths only if length is greater than 3.
{word: [1] for word in words if len(word) [2] 3}The dictionary maps each word to its length if the length is greater than 3.
Fill all three blanks to create a dictionary comprehension that maps uppercase keys to values only if value is positive.
result = { [1]: [2] for k, v in data.items() if v [3] 0 }This comprehension creates a dictionary with uppercase keys and values where values are positive.