Python 从序列中的数据帧列中删除字

Python 从序列中的数据帧列中删除字,python,regex,pandas,Python,Regex,Pandas,我有一个dataframe,在第0列中有一些单词: stopwords 0 1 a 2 ab ... 10 der 如何从使用str.lower().str.split(expand=True.stack.value\u counters())获得的系列中删除此项: 因此,所有位于停止字中的字都将被删除(精确匹配): Wordcount die 2931707 .... 将stopwords列转换为索引列,然后与以下内容一起使用: 或将列传递给isin函数: #no m

我有一个dataframe,在第0列中有一些单词:

stopwords

    0
1   a
2   ab
...
10  der
如何从使用
str.lower().str.split(expand=True.stack.value\u counters()
)获得的系列中删除此项:

因此,所有位于停止字中的字都将被删除(精确匹配):

Wordcount
die 2931707
....

将stopwords列转换为索引列,然后与以下内容一起使用:


或将列传递给
isin
函数:

#no match
s3 = Wordcount[~Wordcount.index.isin(stopwords[0])]

#match
s4 = Wordcount[Wordcount.index.isin(stopwords[0])]
stopwords = stopwords.set_index(0)
#no match
s3 = Wordcount[~Wordcount.index.isin(stopwords.index)]

#match
s4 = Wordcount[Wordcount.index.isin(stopwords.index)]
#no match
s3 = Wordcount[~Wordcount.index.isin(stopwords[0])]

#match
s4 = Wordcount[Wordcount.index.isin(stopwords[0])]