Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello I need help with this small program using python and anaconda (The columns for the datafile timesheet.csv are: ID numbers of Drivers, the weeks
Hello I need help with this small program using python and anaconda (The columns for the datafile "timesheet.csv" are: ID numbers of Drivers, the weeks they are driving, no of hours in each week they are driving, and the miles they are covering each week.)
- Write two map-reduce programs which will demonstrate:
- Each driver has driven a total no of hours
- Each driver has a total no. of miles
- Your code will have comments
- The python code to be modified:
from mrjob.job import MRJob class MRRatingCounter(MRJob): def mapper(self, key, line): (userID, movieID, rating, timestamp) = line.split('\t') yield rating, 1 # yield = return the ratings and no 1 adds all the ratings up in the reducer stage def reducer(self, rating, occurences): yield rating, sum(occurences) if __name__ == '__main__': MRRatingCounter.run()
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