TypeError: expected string or bytes-like object for a dataframe colunms code example
Example: TypeError: expected string or bytes-like object
def fix_Plan(location):
letters_only = re.sub("[^a-zA-Z]",
" ",
location)
words = letters_only.lower().split()
stops = set(stopwords.words("english"))
meaningful_words = [w for w in words if not w in stops]
return (" ".join(meaningful_words))
col_Plan = fix_Plan(train["Plan"][0])
num_responses = train["Plan"].size
clean_Plan_responses = []
for i in range(0,num_responses):
clean_Plan_responses.append(fix_Plan(train["Plan"][i]))