Code Correction: The following code is supposed to perform a…

Code Correction: The following code is supposed to perform a groupby operation and calculate the mean salary by department, but it has errors. Identify and fix ALL the errors. avg_salary = df.groupby[“department”][“salary”].mean print(avg_salary) Write the corrected code below:

Code Correction: The following code is supposed to filter a…

Code Correction: The following code is supposed to filter a DataFrame to show only rows where salary is greater than 50000 and department is ‘Sales’, but it has errors. Identify and fix ALL the errors. filtered = df[df[‘salary’] > 50000 and df[‘department’] == ‘Sales’] print(filtered) Write the corrected code below: