Попробуйте, если это работает только одно линейное решение:
df = pd.DataFrame({'Cites_Dogs': ['DOG45555' ,'DOG127' , 'DOG7760' ,'DOG45','DOG559','DOG760','DOG123','DOG789','DOG860'],
'Dog_Number': ['DOG123', 'DOG123', 'DOG126', 'DOG126', 'DOG126', 'DOG126', 'DOG127', 'DOG127', 'DOG127']})
a = ['DOG123', 'DOG126', 'DOG127']
df['Cites_Dogs'][~df['Cites_Dogs'].isin(a)] = np.nan
df.replace([np.nan], '', inplace=True)
df = df.groupby('Dog_Number')['Cites_Dogs'].apply(list)
# and output looks like this
Dog_Number
DOG123 [, DOG127]
DOG126 [, , , ]
DOG127 [DOG123, , ]
Name: Cites_Dogs, dtype: object
Спасибо!