Get a list of indexes for list A based on criteria in list B in Python
Consider doing this only with a single for loop, i.e. zip the two
lists, sort them by IDs and Yes/No (Yes first so those end up in
front in each block), enumerate and then, while keeping track of the
current block ID, simply always take the first element from each block
and append it to c.  E.g.:

a=[1,1,1,2,2,3,3,1]
b=['No','Yes','No','Yes','No','No','No','No']

d = list(enumerate(zip(a, b)))

def compare(x, y):
    same_ids = cmp(x[0], y[0])
    return -cmp(x[1], y[1]) if same_ids == 0 else same_ids

d.sort(cmp=compare, key=lambda x: x[1])

c = []
last = None
for i, (x, y) in d:
    if last != x or last == None:
        c.append(i)
    last = x


At the price of more memory consumption you could also just do a linear
scan and keep a dictionary around that records the best choice per ID so
far.  E.g.:

from itertools import izip

a=[1,1,1,2,2,3,3,1]
b=['No','Yes','No','Yes','No','No','No','No']

known = {}
for i, (x, y) in enumerate(izip(a, b)):
    current = known.get(x)
    if not current or y == 'Yes' and current[1] == 'No':
        known[x] = (i, y)

c = [i for (i, _) in known.itervalues()]