【发布时间】:2020-06-13 08:40:01
【问题描述】:
我正在尝试从这些数据中删除停用词
DateTime Clean
2020-01-07 then 28
and 28
pizza 14
capital 14
... ... ...
2020-03-31 college 14
included 14
of 14
...........
数据来自
df4.groupby('DateTime').agg({'Clean': 'value_counts'}).rename(columns={'Clean': 'Count'}).groupby('DateTime').head(4)
如何从这个频率列表中删除这些停用词?
分组前的数据样本(原始数据):
Text Clean
all information regarding the state of art ... [all, information, regarding, the, state, of, art ...
all information regarding the state of art ... [all, information, regarding, the, state, of, art ...
to get a good result you should ... [to, get, a, good ,...
第一个是我需要标记的文本。 Clean 应该包含每个文本的标记化。我需要按日期时间查看单词的频率,如下所示,但不包括停用词。
【问题讨论】:
-
我做了
remove_words = list(stopwords.words('english'))+list(more_stop)和df4.Clean=df4.Clean.apply(lambda x: list(word for word in x.split() if word not in remove_words))