Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago