0
0
Hadoopdata~10 mins

GROUP and JOIN operations in Hadoop - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to group data by the 'department' field.

Hadoop
grouped_data = data.[1]('department')
Drag options to blanks, or click blank then click option'
Aselect
BgroupBy
Cfilter
Djoin
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'join' instead of 'groupBy' to group data.
Using 'filter' which selects rows, not groups.
2fill in blank
medium

Complete the code to join two datasets on the 'employee_id' column.

Hadoop
joined_data = data1.[1](data2, 'employee_id')
Drag options to blanks, or click blank then click option'
Ajoin
Bselect
CgroupBy
Dfilter
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'groupBy' instead of 'join' to combine datasets.
Using 'filter' which only selects rows.
3fill in blank
hard

Fix the error in the join operation by completing the code correctly.

Hadoop
result = data1.join(data2, data1.[1] == data2.employee_id)
Drag options to blanks, or click blank then click option'
Aemployee_id
Bdept_id
Cid
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong column like 'id' or 'name' for join condition.
Not matching the same key columns in join.
4fill in blank
hard

Fill both blanks to create a dictionary of employee names and their project counts for employees with more than 2 projects.

Hadoop
result = {emp.name: emp.[1] for emp in employees if emp.[1] [2] 2}
Drag options to blanks, or click blank then click option'
Aproject_count
Bprojects
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'projects' which might be a list, not a count.
Using '<' instead of '>' to filter employees.
5fill in blank
hard

Fill all three blanks to create a dictionary of department names and total salaries for departments with total salary above 100000.

Hadoop
dept_salaries = {dept.[1]: sum(emp.[2] for emp in dept.employees) for dept in departments if sum(emp.[2] for emp in dept.employees) [3] 100000}
Drag options to blanks, or click blank then click option'
Aname
Bsalary
C>
Ddepartment
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'department' instead of 'name' for department key.
Using '<' instead of '>' for filtering.
Using wrong attribute for salary.