I am carrying out EDA on a dataset and want to count the total number of words in a column, before and after deleting duplicates.
Here is my code:
print(train_dataset['text'].apply(lambda x: len(x.split(' '))).sum())
It is throwing this error:
AttributeError: 'float' object has no attribute 'split'
You could try to convert column values to string type before split: