I want to sort words by their repetition rate and convert them to csv table with this code:
from collections import Counter
import pandas as pd
stoplist = ['.', 'and', 'was', 'in', 'a', 'the', ',', '?', ':']
text1 = str(input("Paste text here: "))
words1 = [s.lower() for s in text1.split() if s.lower() not in stoplist]
data = {'words': words1}
df = pd.DataFrame(data)
df = df['words'].value_counts()
df.to_csv('out.csv')
However, for some reason stoplist isn't working: there are still words with commas, dots, etc in it: