I am a naive in python and started learning python few months ago I am working on twitter data in my local, it has 4 columns. ID, brand, sentiment, comment def data_clean_pipeline(text): #removing html tags text = str(BeautifulSoup(text).get_text()) #removing any nonletter words text = re.sub("[^a-zA-Z]", " ", text) text = text.lower() text = nltk.word_tokenize(text) SW = stopwords.words('english') text = [t for t in text if not t in set(SW)] #Then we can apply stemming and then lemmitize the data SS_stem = SnowballStemmer(language='english') text = [SS_stem.stem(t) for t in text] word_lemmitize = WordNetLemmatizer() text = [word_lemmitize.lemmatize(t) for t in text] return " ".join(text) When I apply this function to one of the review in twitter data it works, but when i apply to the entire column for example data_clean_pipeline(twitter_data['comment'][0] #it works fine and return the output but the error occurs when i apply this function to a column twitter_data['clean'] = twitter_data['comment'].apply(data_clean_pipeline) Any feedback would be helpful, thank you i have attached an image of my error code in the image description for the python error window enter image description here I was expecting that it will apply the function to the entire comment column which is not happening. I have tried to make multiple unsuccessful attempts Continue reading...