Complete the code to group the DataFrame by the 'Category' column.
grouped = df.[1]('Category')
The groupby method groups data based on column values, which is essential for aggregation.
Complete the code to calculate the average sales for each group.
average_sales = grouped.[1]()['Sales']
The mean function calculates the average value for each group.
Fix the error in the code to get the total sales per group.
total_sales = df.groupby('Category').[1]()
The sum method adds up all sales values in each group.
Fill both blanks to create a dictionary of word lengths for words longer than 3 characters.
lengths = {word: [1] for word in words if len(word) [2] 3}We use len(word) to get the length and filter words with length greater than 3 using >.
Fill all three blanks to create a dictionary of uppercase words and their counts for words with count greater than 1.
result = [1]: [2] for word, count in word_counts.items() if count [3] 1
We convert words to uppercase with word.upper(), keep the count, and filter counts greater than 1 using >.