Search for question
Question

[ ]: Graded Exercise 1 Write and run the code to show the summary statistics for average_monthly_hours Selecting Data []: #Show the specified columns df_data_1.select('Department', 'satisfaction_level', 'salary', 'Attrition').show(10) Graded Exercise 2

Write and run the code to select ID. department salary. Attrition and show the first 5 rows. [ ]: # Rename the column in the output. For instance, abbreviate satisfaction level as sl df_data_1.select('Department', 'satisfaction_level', 'salary', 'Attrition').withColumnRenamed('satisfaction_level', 'sl').show(10) []: # List the distinct values. For instance, List the department names df_data_1.select('Department').distinct().show()/nGraded Exercise 3 Write and run the code to display the distinct salary values. [] #Return the number of distinct values in a column. For instance, return the number of departments df_data_1.select('Department').distinct().count() []: # First 20 employees with the job satisfaction above 9.8 df_data_1.select('Department, 'satisfaction_level', 'salary', 'Attrition').filter (df_data_1['satisfaction_level"]>9.8).show() Graded Exercise 4 Modify and run the code from Graded exercise 2 to return the ID, department, salary. Attrition for the first 5 employees in hr department.

Fig: 1

Fig: 2