Access multiple items with not equal to, !=
I like using the query method as it's a bit more clear
df = df.query("Train not in ['DeutscheBahn', 'British Rails', 'SNCF']")
df[~df['Train'].isin(['DeutscheBahn', 'SNCF'])]
isin
returns the values in df['Train']
that are in the given list, and the ~
at the beginning is essentially a not
operator.
Another working but longer syntax would be:
df[(df['Train'] != 'DeutscheBahn') & (df['Train'] != 'SNCF')]