We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to join between two files,but I get Error error : NameError: name 'names' is not defined
!python job.py data.txt --database item.txt
from mrjob.job import MRJob from mrjob.step import MRStep class MRPeopleScores(MRJob): def steps(self): return [ MRStep(mapper=self.mapper_1,reducer_init=self.reducer_init, reducer=self.reducer_1) ] def configure_args(self): super(MRPeopleScores, self).configure_args() self.add_file_arg('--database') def mapper(self, _, line): (employee_id, age,var_,salary) = line.split("\t") yield int(employee_id), salary def reducer_init(self): with open("item.txt") as f: for line in f: fields = line.split('|') self.names[fields[0]] = fields[1] def reducer(self,employee_id, salary): for salary_ in salary: yield employee_id,(salary_,names[employee_id]) if __name__ == '__main__': MRPeopleScores.run()
The text was updated successfully, but these errors were encountered:
Hello: I think that you should declare self.names=[] under reducer_init, and to add "self.names..." in the last yield. Best.
Sorry, something went wrong.
No branches or pull requests
I want to join between two files,but I get Error error : NameError: name 'names' is not defined
!python job.py data.txt --database item.txt
The text was updated successfully, but these errors were encountered: