pandas dataframe check if column contains string that exists in another column
问题 I am trying to learn about Dataframes but I'm still a beginner. Let's say I have a DataFrame that contains two columns: Name Description Am Owner of Am BQ Employee at BQ JW Employee somewhere I want to check if the name is also a part of the description, and if so keep the row. If it's not, delete the row. In this case, it will delete the 3rd row (JW Employee somewhere) 回答1: Try this: df[df.apply(lambda x: x['Name'] in x['Description'], axis = 1)] 回答2: s='|'.join(df.Name)#Join the search