我有功能newspaper3k
提取给定网址的摘要。给定为:-
def article_summary(row):
url = row
article = Article(url)
article.download()
article.parse()
article.nlp()
text = article.summary
return text
我有熊猫数据框,其列名为url
url
https://www.xyssss.com/dddd
https://www.sbkaksbk.com/shshshs
https://www.ascbackkkc.com/asbbs
............
............
还有另一个函数main_code()
运行得非常好,我在里面使用article_summary
。我想将这两个函数都添加article_summary
到main_code()
一个函数final_code
中。
这是我的代码:第一个功能为:-
def article_summary(row):
url = row
article = Article(url)
article.download()
article.parse()
article.nlp()
text = article.summary
return text
这是第二个功能
def main_code():
article_data['article']=article_data['url'].apply(article_summary)
return article_data['articles']
当我完成时:
def final_code():
article_summary()
main_code()
但final_code()
没有给出任何输出,它显示为TypeError: article_summary() missing 1 required positional argument: 'row'