因此给出这个示例系列
s = pd.Series(["Redirecting (301) to <GET http://www.vix.com/pt/mulher> from <GET http://www.vix.com/pt/bolsademulher>'",
"Redirecting (307) to <GET https://twibbon.com/> from <GET http://twibbon.com/>'"])
我能够像这样提取第一个网址:
s.str.extract('(https?://[^>]+)', expand=True)
但我想提取两个网址,每个网址到不同的列。
最佳答案
s.str.extractall('(https?://[^>]+)').unstack()
关于python - 提取 pandas 字符串字段中出现的两个 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45172532/