【发布时间】:2019-03-04 02:40:56
【问题描述】:
这是我的代码,我想得到包含 b 和 c 的结果,但它给了我错误。
df = pd.read_excel('C:Test 0926.xlsx')
df.drop_duplicates(['mention'],inplace=True)
a = df['mention'].str.lower()
searchfor =[some words in it]
b = a[a.str.contains('|'.join(searchfor))]
opposite = [some words in it]
c = a[a.str.contains('|' .join(opposite))]
def check_it(sentences):
if b and c in sentences:
return sentences
d = a.apply(lambda x:check_it(x))
print(d)
有人可以帮忙吗?
【问题讨论】:
-
请将您收到的错误添加到您的问题中。
-
...阅读stackoverflow.com/help/how-to-ask。目前,您的代码提供了许多出错的机会。