Question
log_data.txt has grading data for 20 assignments in the following format: fname, lname, score (assume last names are distinct) data_rdd = sc.textFile(log_data.txt) grades_rdd = data_rdd.split(',').map(lambda
log_data.txt has grading data for 20 assignments in the following format: fname, lname, score (assume last names are distinct)
data_rdd = sc.textFile("log_data.txt")
grades_rdd = data_rdd.split(',').map(lambda grade: tup(str(grade[1]), int(grade[2]))).reduceByKey(lambda grade1, grade2: grade1 + grade2).map(lambda average: (average[0], average[1]/20))
True or false: the code above will calculate the average score for each student based on their last name. Note: I didn't actually run this code, so you may assume the syntax is correct without running it.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started