'Why does python only return first line of text after removing stop words?
I am trying to remove stop words from my text document that contains multiple paragraphs, no tables. My code is below. When I print the data after removing the stop words it only returns the first line of the text file not all the paragraphs. Not sure what I am doing wrong.
data1 = pd.read_csv('001.txt', sep='\n')
stop = set(stopwords.words('english'))
def clean(doc):
stop_free = " ".join([i for i in doc.lower().split() if i not in stop])
return stop_free
data1_clean = [clean(doc).split() for doc in data1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
