I'm trying to add a column to the DF, depending on whether other column's value contains any of the strings in a list.
The list is:
services = [
"TELECOM",
"AYSA",
"PERSONAL"
]
And so far I've tried:
payments["category"] = "services" if payments["concept"].contains(service for service in services) else ""
And this:
payments["category"] = payments["concept"].apply(lambda x: "services" if x.contains(service) for service in services) else ""
Among some other variations... I've seen other questions but they're mostly related to the opposite problem (checking whether a column's value is contained by a string in a list)
I could use your help! Thanks!!