I am a beginner with MrJob and having trouble calculating an average prime number from a text file of prime numbers. I am unsure at which part to apply arithmetic logic and also whether I should yield lists when using MrJob. The text file contains one million primes and this is what I've come up so far, I don't understand what the key value should be in my case.
%%writefile prime_average.py
from mrjob.job import MRJob
class primeAverages(MRJob):
def mapper(self, _, line):
results = []
for x in line.split():
if(x.isdigit()):
yield x, 1
def reducer(self, word, key):
yield word, sum(word)/len(key)