Pandas DataFrame to_html or iterate over the data in the template?

1

I actually wanted to iterate over the data in the template?

But how do I play my pivot data in context and treat them in the template?

df = pd.DataFrame(data)
pv = df.pivot(index='cands', columns='titles', values='grades')
context['quizzes'] = pv.to_html(classes='table', border=0, na_rep = '')

In the template I'm doing {{ quizzes }} , but I wanted to do

{% for quiz in quizzes %}
    <tr>
        <td>{{ quiz.first_name }}</td>
        <td>{{ quiz.title }}</td>
    </tr>
{% endfor %}

So on.

    
asked by anonymous 04.10.2017 / 03:09

0 answers