Complete the code to create a new column 'double' by doubling the 'value' column using vectorized operations.
df['double'] = df['value'] [1] 2
Multiplying the 'value' column by 2 doubles each element using vectorized operations.
Complete the code to calculate the mean of the 'score' column using a vectorized pandas method.
mean_score = df['score'].[1]()
sum() returns total, not average.count() returns number of entries, not average.The mean() method calculates the average value of the 'score' column efficiently.
Fix the error in the loop that adds 10 to each element in the 'points' column and stores results in a list.
results = [] for [1] in df['points']: results.append(x + 10)
The loop variable must match the variable used inside the loop. Here, x is used, so the loop should iterate with for x in df['points'].
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 comprehension maps each word to its length using len(word). The condition filters words with length greater than 3 using >.
Fill all three blanks to create a dictionary comprehension that maps uppercase words to their scores only if score is positive.
result = { [1]: [2] for word, score in data.items() if score [3] 0 }word.lower() instead of uppercase.The comprehension maps the uppercase version of each word (word.upper()) to its score (score) only if the score is greater than zero (> 0).