Can't I use a isin
within a lambda function. E.g.
mylist = ["A", "B", "C"]
df["Col2"] = df["Col1"].apply(lambda x: 1 if x.isin(mylist) else 0)
I'm getting an AttributeError: 'str' object has no attribute 'isin'
but the following filter works though:
df[df["Col1"].isin(mylist)]