Dataframe - selecting specific rows that contain the words of a given list

Hi all,

I am having trouble with the ‘This is Jeopardy’ python project centred around dataframes.

I am trying to use a function to extract the rows of the dataframe that have ‘questions’ which contain specific words (in this case the words are: [“King”, "England])

I have provided my code and the question below. I am just not sure why the code I am using is returning the full dataframe of ‘null’ values. I have looked at the provided solution but am not content as to why my code does not work so any help/ explaination you can provide would be very much appreciated!!

many thanks.

Q. Write a function that filters the dataset for questions that contain all of the words in a list of words. For example, when the list ["King", "England"] was passed to our function, the function returned a DataFrame of 49 rows. Every row had the strings "King" and "England" somewhere in its " Question".Test your function by printing out the column containing the question of each row of the dataset.

Code:

def question_word_search(df, column, words):
    filtered_questions = df[df[column].isin(words)]
    print(len(filtered_questions))
    return filtered_questions.head(5)

question_word_search(jeopardy_table, "question", ["King", "England"])