I have a data frame like this:
df:
ID Names
3 [Ally, Ben, Cris]
5 [Bruno, Coleen, Flyn]
2 [Dave, Bob]
7 [Rob, Ally, Bob]
11 [Jill, Tom, Sal]
The Names column is a list of names. Some of them could be repeated.
I want to filter the data frame on Names columns where the names start with either A or B or D.
So my output should look like this:
ID Names
3 [Ally, Ben]
5 [Bruno]
2 [Dave, Bob]
7 [Ally, Bob]
Reproducible input:
df = pd.DataFrame({'ID': [3, 5, 2, 7, 11],
'Names': [['Ally', 'Ben', 'Cris'],
['Bruno', 'Coleen', 'Flyn'],
['Dave', 'Bob'],
['Rob', 'Ally', 'Bob'],
['Jill', 'Tom', 'Sal']]
})