Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "url":Stackoverflow.com/login,
- "count": 200.654,
- "browsers":[
- Firefox 33,
- IE 7,
- Opera
- ]
- },
- {..},
- {..}
- ],
- FULL_URL_WHERE_DOMAIN_EQUALS = mySuperCoolRegex
- class MRReferralAnalysis(MRJob):
- def mapper(self, _, line):
- for group in FULL_URL_WHERE_DOMAIN_EQUALS.findall(line):
- yield (group, 1)
- def reducer(self, itemOfInterest, counts):
- yield (sum(counts), itemOfInterest)
- def steps(self):
- return [
- MRStep( mapper=self.mapper,
- reducer=self.reducer)
- ]
- if __name__ == '__main__':
- MRReferralAnalysis.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement