I am filtering a dataframe where a column == one of these numbers (must be in string format):
numbers = [
'013237918',
'70261045',
'70261125',
'70275745',
'70325295',
'70346445',
'70377495',
'70428835',
'74908083',
'75316203'
]
# filter the DF
df[df['column'].str.contains('|'.join(numbers))]
Which im 99% sure works.
However what if one of the rows contained my number, but also an extra number at the end. Or an extra letter. For example '70377495abx'. That would appear in the above search, however I don't want it.
I want the rows where the column equals exactly one of the items in the list.
Like
df[df['column'].str.equals('|'.join(numbers))]
Does something like this exist?