2 回答
TA贡献1817条经验 获得超6个赞
所以我得出以下解决方案:
for file in file_list:
count_lm_constraint = 0
count_lm_litigious = 0
count_lm_modal_me = 0
for word in text.split()
if word in df_lm.iloc[0,1]:
count_lm_constraint = count_lm_constraint +1
if word in df_lm.iloc[1,1]:
count_lm_litigious = count_lm_litigious +1
if word in df_lm.iloc[2,1]:
count_lm_modal_me = count_lm_modal_me +1
a={"File": name, "Text": text,'lm_uncertain':count_lm_uncertain,'lm_positive':count_lm_positive ....}
result_list.append(a)
TA贡献1810条经验 获得超4个赞
根据我的评论,你可以尝试这样的事情:
下面的代码必须在循环中运行,其中来自第一个 df 的文本列必须与来自下一个的所有 6 列匹配,并使列的值来自 len(c)
desc = df_lm.iloc[0,1]
matches = df.text.isin(desc)
result = df.text[matches]
如果这对您有帮助,请告诉我,否则将更新/删除答案
添加回答
举报