创建包含超链接文本的URL的列
我有一个数据源,其中包含超链接的文本列。当我在大熊猫上阅读时,超链接消失了。我仍然想获取每个行的URL,并将其创建为一个称为“ URL”的新列。
因此,想法是创建一个包含URL的新列。在此示例中,PANDAS DataFrame将有4列:
- 协议代码
- URL
- 实体名称
- 协议日期
I have a data source that has a column containing text that is hyperlinked. When I read at pandas, the hyperlinks are gone. I want to still get the URL of each of the rows and create it into a new column called "URL".
So, the idea is to create a new column that contains the URL. In this example, the pandas dataframe will have 4 columns:
- Agreement Code
- URL
- Entity Name
- Agreement Date
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知在这里。此外,您可以使用
OpenPyXl
来完成此任务:您可以迭代行以获取所有超链接并存储在新列中。有关
OpenPyXl
的更多详细信息,请参阅 docs 。As per my knowledge pandas doesn't have this functionality as there is an open feature request for hyperlinks here. Moreover you can use
openpyxl
to accomplish this task:You can iterate row-wise to get all the hyperlinks and store in a new column. For more details regarding
openpyxl
please refer the docs.