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

2012-07-09 Thread Fred G
Sorry, just got that as well. It was the placement of the if-statement in the nested for-loop. so v was stuck on 3...thanks again for the help with this!!! On Mon, Jul 9, 2012 at 1:57 PM, Fred G wrote: > Got it! Thanks guys for all your help--what a satisfying feeling! Just > out of curiosity

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 f

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 in

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 wrote: > 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

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 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 then > is just: > > for

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 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