Q:

Accessing nested dictionaries based on index of master dictionary

I have the value of a nested value in dictionary (Photo_id) in below, how can I get the indexed value for a different dictionary (i.e. sample_id) at the same index?
I have a dictionary with sub dictionaries inside:
per_row = organised.to_dict('index')
        {0: {'Photo_id': nan, 'Photo_Desc': nan, 'Sample_id': 20025521L},
         1: {'Photo_id': 1460, 'Photo_Desc': u'S', 'Sample_id': 20025523L},
         2: {'Photo_id': u'1366, 1367, 1368', 'Photo_Desc': u'C', 'Sample_id': 20025522L}}

How can I do a look for for check the index and give me the photo_desc value thats there? 
I.e. I have f_id 1366 and I want the script to tell me that photo_desc = C
My code is below:
for key, value in per_row.iteritems():
    print key, value
    for k,v in value.items():
        print k,v
        if k == 'Photo_id':
            v = str(v)
            if v == 'nan':
                pass
            else:
                print v
                print type(v)
                for fid in v.split():
                    print "fid " + fid
                    removedcommas = re.sub(',', '', fid)
                    print "Photo id cleaned: "+ removedcommas

                    *** Now check photo_desc:
                    if photo_desc == 'C':
                        do this
                    else photo_desc == 'S':
                        do something else

output:
1 {'Photo_id': 1460, 'Photo_Desc': u'S', 'Sample_id': 20025523L}
Photo_id 1460
1460

A:

To get photo_desc, simply access value['Photo_Desc']. 

