Re: [Tutor] Mapping ID's for corresponding values in different Columns

2012-07-09 Thread Hugo Arts
On Sun, Jul 8, 2012 at 11:47 PM, Fred G bayespoker...@gmail.com wrote: Hi-- My current input looks like the following: FILE1.csv PERSON_IDPERSON_NAME 1 Jen 2 Mike 3 Jim 4 5 Jane 6

Re: [Tutor] Mapping ID's for corresponding values in different Columns

2012-07-09 Thread Fred G
Thank you guys so much. I'm quite close now, but I'm having a bit of trouble on the final for-loop to create the new dictionary. I have the following 3 functions (note I'm re-typing it from a different computer so while the identation will be off here, it is correct in the actual code): #read

Re: [Tutor] Mapping ID's for corresponding values in different Columns

2012-07-09 Thread Fred G
Got it! Thanks guys for all your help--what a satisfying feeling! Just out of curiosity, in the following: def new_dict (csv_to_dict, nested_line): old_dict = csv_to_dict(file1) old_list = nested_line(file2) new_dict = {} #for item in old_list: #new_dict[item] = item

[Tutor] Mapping ID's for corresponding values in different Columns

2012-07-08 Thread Fred G
Hi-- My current input looks like the following: FILE1.csv PERSON_IDPERSON_NAME 1 Jen 2 Mike 3 Jim 4 5 Jane 6 Joe 7 Jake FILE2.csv PERSON_ID PERSON_NAME

Re: [Tutor] Mapping ID's for corresponding values in different Columns (UPDATE)

2012-07-08 Thread Fred G
I thought it made sense to read the two columns in File1 in as a dictionary (where the key is actually the name, so that we can search on it later), and the column of interest in File2 as a list. Finding the common values then is just: for item in file2_list: for line in file1_dict: if

Re: [Tutor] Mapping ID's for corresponding values in different Columns (UPDATE)

2012-07-08 Thread Walter Prins
On 9 July 2012 00:50, Fred G bayespoker...@gmail.com wrote: I thought it made sense to read the two columns in File1 in as a dictionary (where the key is actually the name, so that we can search on it later), and yes... the column of interest in File2 as a list. Finding the common values