Complete the code to group the DataFrame by the 'Category' column.
grouped = df.groupby([1])To group by a column name, you pass the column name as a string to groupby.
Complete the code to calculate the mean of each group.
mean_values = df.groupby('Category').[1]()
The mean() function calculates the average value for each group.
Fix the error in the code to group by 'Category' and 'Subcategory'.
grouped = df.groupby([1])To group by multiple columns, pass a list of column names as strings.
Fill both blanks to create a dictionary with word lengths greater than 3.
lengths = {word: [1] for word in words if len(word) [2] 3}The dictionary maps each word to its length, but only includes words longer than 3 characters.
Fill all three blanks to create a filtered dictionary with uppercase keys and values greater than 0.
result = { [1]: [2] for k, v in data.items() if v [3] 0}k.lower() instead of k.upper().This dictionary comprehension creates keys as uppercase versions of original keys, keeps values as is, and filters to only include values greater than zero.