can someone help me !! i have that error "expected string or bytes-like object"

corpus = []
for i in range (117):
    rev=re.sub("[^a-zA-Z]"," ",a.iloc[i,2])
    rev=[ps.stem(word) for word in rev if not word in set (stopwords.words("french"))]
    rev=" ".join(rev)

Here is the error:

> --> 210     return _compile(pattern, flags).sub(repl, string, count)
>     211 
>     212 def subn(pattern, repl, string, count=0, flags=0):
> TypeError: expected string or bytes-like object

Read more here:

Content Attribution

This content was originally published by Faouzi YAHYAOUI at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: