This should work as you want:
import csv
diseases = {}
# Load the disease file in memory
with csv.reader(open('table1.csv', 'rb')) as dfile:
# Skip the header
dfile.next()
for disease, gene, pvalue in dfile:
diseases[gene] = (disease, pvalue)
with csv.reader(open('table2.csv', 'rb')) as idfile, csv.writer(open('output.csv', 'wb')) as output:
# Skip the header
idfile.next()
for ident, homologue, symbol in idfile:
if symbol in diseases:
output.writerow((ident, homologue, symbol) + diseases[symbol])
It assumes that every gene name under Mapped_gene
is unique, though. It can be easily extended to cope with duplicates, otherwise.