I have a column containing the first word from each text and am trying to check if it is in the nltk word list. My code is:
from nltk.corpus import words
wordlist = words.words()
reviews['test'] = reviews.apply(lambda x: True if x['FIRST_WORD'] in wordlist else False )
I'm getting an error:
KeyError: 'FIRST_WORD'
Not sure why because that is definitely the name of the column in my data set. Have I set up the lambda function wrong?