[英]How to extract URLs from many lines in a pandas dataframe in Python
當我使用多個元素進行提取時,如何使用提取器。
我的數據框中有一個 excel 表,我想提取 dataframe2.Comment 中的所有 URL。
我用這個:
from urlextract import URLExtract
extractor = URLExtract()
dataframe2.Comment = extractor.find_urls(dataframe2.Comment)
我得到錯誤:
預期的字符串或類似字節的對象
你能幫我么?
我希望您需要將提取器應用於列的每個單獨值而不是整個列。
from urlextract import URLExtract
extractor = URLExtract()
dataframe2.Comment = dataframe2.Comment.apply(extractor.find_urls)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.