ages = list() for aID, eID in ids: aKey, eKey = list(sAR[aID].keys())[0], list(sER[eID].keys())[0] A, E = sAR[aID][aKey], sER[eID][eKey] ages.append((A.x[2], E.x[2])) ages = np.array(ages)