Python 删除停止词后从列创建词汇表
我想创建一个语料库/词汇表,由我的数据框架中的一列中的所有文本(标记化)组成:Python 删除停止词后从列创建词汇表,python,pandas,Python,Pandas,我想创建一个语料库/词汇表,由我的数据框架中的一列中的所有文本(标记化)组成: User Text 312 Include details about your goal 41 Describe expected and actual results 421 Include any error messages 我想做的是首先删除停止词,然后将所有标记词添加到列表中,即: my_list=['Include', 'details', 'goal', 'Describe', 'expec
User Text
312 Include details about your goal
41 Describe expected and actual results
421 Include any error messages
我想做的是首先删除停止词,然后将所有标记词添加到列表中,即:
my_list=['Include', 'details', 'goal', 'Describe', 'expected', 'actual', 'results', 'Include', 'error', 'messages']
我做了如下尝试:
df['Text'].apply(lambda x: [item for item in x if item not in stop_words])
但是它给了我性格,而不是文字。你不需要申请
l = df.Text.str.split(' ').sum()
yourlist = [x for x in l if x not in stop_words]