Using Python Flask app to render a html table with 'for' loop implementation. But the data doesn't render giving a blank <tr><tr>.
I am converting a dataframe to html by passing a dff.to_html() from render_template and retrieving the table in html in a 'for' loop to display.
Python code:
return render_template('index.html', table = dff.head(50).to_html())
html code:
<table>
<tbody>
{% for row in table %}
<tr>
<td>{{row.name}}</td>
<td>{{row.link_to_detail}}</td>
<td>{{row.link}}</td>
<td><input name ="get poster" type="submit" value={{row['id']}}></td>
</tr>
{% endfor %}
</tbody>
</table>
Actual result is
<tr>
<td></td>
<td></td>
<td></td>
<td><input name="get poster" type="submit" value=""></td>
</tr>
Expected result :
<tr>
<td>name</td>
<td>link_to_detail</td>
<td>link</td>
<td><input name="get poster" type="submit" value=""></td>
</tr>
'''
tableis a string with HTML so you can use{{ table }}to put it in template.