Question: how to install pydoop.mapreduce for Python. Need to run: import pydoop.mapreduce.api as api import pydoop.mapreduce.pipes as pp class Mapper ( api . Mapper ) :

how to install pydoop.mapreduce for Python. Need to run: import pydoop.mapreduce.api as api
import pydoop.mapreduce.pipes as pp
class Mapper(api.Mapper):
def map(self, context):
row = context.value.strip().split(",")
context.emit(row[1], row[25])
class Reducer(api.Reducer):
def reduce(self, context):
yards = context.values
count =0
total_yards =0
for yard in yards:
if yard !="NA":
count +=1
total_yards += int(yard)
if count >0:
avg_yards = total_yards / count
context.emit(context.key, avg_yards)
def __main__():
pp.run_task(pp.Factory(Mapper, Reducer)) and getting error. Need output for this code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!