I want to calculate frequency of a word in a sentence. My dataframe has a "Title" column which contains a sentence (String) in each row. This is my current approach:
# num times queryWord is in sentence / num words in sentence
list = df['Title'].str.count(queryWord) / len(df['Title'].str.split())
However, len(df['Title'].str.split())
returns the length of the "Title" column rather than the length of the array that is generated by split() in each row. How do I fix this?