Reputation: 1040
I am trying to create a new column that has the pos tag of the column clean_word
in a data frame. This column has single words as you may see in the below picture. So no tokenization and so on needed.
Below is my code.
import nltk
datahitword['pos_tag'] = nltk.pos_tag(datahitword['clean_word'])
datahitword.head()
I am getting the below error, even after turning the column into a list and series to process it isolated and then add to the data frame.
TypeError: argument of type 'float' is not iterable
Is there something I am missing here?
Upvotes: 1
Views: 466
Reputation: 1040
As @alvas recommended. Just needed to convert the words into strings
datahitword['clean_word'] = datahitword['clean_word'].astype(str)
Upvotes: 1