I have created a Pivot table and now need to convert it do a Django table.
I get this data with this:
df = pd.pivot_table ( df, index = [ "category" ], columns=['date'], values = ['comm'], aggfunc = np.sum, fill_value=0 )
which gives me this:
comm
date 2013-12-28 2014-12-27 2015-12-25 2016-12-31 2017-05-20
category
CONT ASSET FEES 3868.32 4450.94 6063.94 5285.85 17479.07
FIXED ANN TRAIL 1299.94 1299.94 1277.24 1223.70 1848.56
....
INSURANCE 5132.08 6017.77 1672.13 0 5059.51
INSURANCE TRAIL 935.05 701.68 623.86 458.45 1357.83
send to the template with this:
context = {
'annual' : df.to_records (),
}
Now need to convert it to a Django table. I am guessing ".comm" will be part of the code.
{% for c in annual %}
<tr>
<td>{{ c.category }}</td>
<td>{{ c.comm|floatformat:"0"|intcomma }}</td>
<td>{{ c.comm|floatformat:"0"|intcomma }}</td>
<td>{{ c.comm|floatformat:"0"|intcomma }}</td>
<td>{{ c.comm|floatformat:"0"|intcomma }}</td>
<td>{{ c.comm|floatformat:"0"|intcomma }}</td>
</tr>
{% endfor %}
obviously I cant you the data string.
what can I do to get this to print?
Thanks!