Complete the code to calculate the mean of the 'sales' column.
mean_sales = df['sales'].[1]()
The mean() function calculates the average value of the 'sales' column.
Complete the code to group data by 'category' and calculate the sum of 'amount'.
grouped = df.groupby('[1]')['amount'].sum()
Grouping by 'category' allows us to sum 'amount' values for each category.
Fix the error in the code to calculate the maximum 'score' per 'team'.
max_scores = df.groupby('team')['[1]'].max()
The column name is exactly 'score' in lowercase. Using the correct column name avoids errors.
Fill both blanks to create a dictionary of average 'price' for items with 'quantity' greater than 5.
avg_price = {item: [1] for item, qty in data.items() if qty [2] 5}We use price_data[item] to get the price for each item and filter items where quantity is greater than 5 using >.
Fill all three blanks to create a dictionary of total 'sales' for each 'region' where sales are above 1000.
total_sales = { [1]: [2] for [3], sales in sales_data.items() if sales > 1000 }The dictionary keys are regions, so region is used for both key and loop variable. The values are sales amounts.