I would like to create a new feature ["EnglishName"] for my feature passenger["Surname"] that occurs anwywhere in another dataframe consisting of a single column containing common English Surnames (surnames["Name"]).
I am struggling to find the right output.
this code gives output but it gives "False" for every Surnames, even the ones that are present in "name"
passenger["EnglishName"] = passenger["Surname"]==(surnames["name"].any())
I thought I could fix this with a lambda expression, but I have not been able to figure out the right format
passenger["EnglishName"] = passenger["Surname"].apply(lambda x: 1 if x.isin(surnames["name"].any()))
I have searched Stackoverflow for similar code, but they often have to do with SQL kind of syntax (matching two dataframes) or the data is not present in a dataframe and you can use .isin without a problem.
What is the right code to anwser this simple question? You help is greatly appreciated!