How to create a pandas "link" (href) style?
<p>From the <a href="http://pandas.pydata.org/pandas-docs/stable/style.html" rel="nofollow">documentation</a> I realize that it is possible to create styles over pandas dataframes. However, I would like to know if it is possible to create a link style. So far this is what I tried:</p>

<pre><code>def linkify(data_frame_col):
 list_words = ['&lt;a href="http://this_is_url_{}"&gt;{}&lt;/a&gt;'.format(a,a) for a in data_frame_col]
 return list_words
</code></pre>

<p>The problem is that when I visualize the pandas dataframe into a flask website I get the following style:</p>

<pre><code>['&lt;a href="http://this_is_url_hi"&gt;hi&lt;/a&gt;',
 '&lt;a href="http://this_is_url_quick fox brown"&gt;quick fox brown&lt;/a&gt;',
 '&lt;a href="http://this_is_url_fall apart"&gt;fall apart&lt;/a&gt;',
 '&lt;a href="http://this_is_url_hi"&gt;hi&lt;/a&gt;',
 '&lt;a href="http://this_is_url_no"&gt;no&lt;/a&gt;']
</code></pre>

<p>Instead of links. Any idea of how to get hrefs like this stye: <a href="http://link.com" rel="nofollow">this</a> inside the pandas dataframe?.</p>

<p><strong>Update</strong></p>

<p>My template looks like this:</p>

<p>view.html:</p>

<pre><code>&lt;!doctype html&gt;
&lt;title&gt;title&lt;/title&gt;
&lt;link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}"&gt;
&lt;div class=page&gt;
  &lt;h1&gt;Title&lt;/h1&gt;
  {% for table in tables %}
    &lt;h2&gt;{{titles[loop.index]}}&lt;/h2&gt;
    {{ table|safe }}
  {% endfor %}
&lt;/div&gt;
</code></pre>

<p>You can use the IPython's display.HTML type</p>

<pre><code>from IPython.display import HTML
import pandas as pd

df = pd.DataFrame(['&lt;a href="http://example.com"&gt;example.com&lt;/a&gt;'])
HTML(df.to_html(escape=False))
</code></pre>

python html python-3.x pandas flask