Reputation: 338
I have a list which has string values.
Example: listofwords = ['A, 'B', 'C']
. I have a dataframe with a column. I want my code to return True
if all the values in the list is in that column.
How can I do this?
Upvotes: 0
Views: 219
Reputation: 1669
Create sets for both and take set-compliment, if its empty that means all items of listofwords are in the Dataframe_column:
len(set(listofwords) - set(df['Dataframe_Column'])) == 0
Upvotes: 1