【发布时间】:2021-07-14 22:05:19
【问题描述】:
我有一个示例数据框
city city_website
LosAngeles https://la.com
Ohio https://ohio.com
Buffalo https://buffalo.com
Manhattan https://manhattan.com
如何将数据框传递给我的示例模板
<!DOCTYPE html>
<html>
<body>
<a href="CITIES URLs">CITIES NAMES</a>
</body>
</html>
不幸的是,我的 html 模板不接受直接数据框来显示内容。我试图将数据帧作为字符串传递给我的 html df = df.to_string()。但是导致
<html>
<body>
<p>Losangeles https://la.com Ohio https://ohio.com Buffalo https://buffalo.com Manhattan https://manhattan.com</p>
</body>
</html>
寻找想要的结果
<html>
<body>
<a href='https://la.com'>LA</a>
<br><a href='https://ohio.com'>Ohio</a>
<br><a href='https://buffalo.com'>Buffalo</a>
<br><a href='https://manhattan.com'>Manhattan</a>
</body>
</html>
【问题讨论】:
标签: python html pandas frontend