[Answered ]-Convert Pandas DataFrame to a list suited for django templates

2👍

Is this what you want?

In [56]: df
Out[56]:
               field3   field4
field1 field2
240502 361     value1  valuef1
       5936    value2  valuef2
       6984    value3  valuef3

In [57]: df.to_dict('r')
Out[57]:
[{'field3': 'value1', 'field4': 'valuef1'},
 {'field3': 'value2', 'field4': 'valuef2'},
 {'field3': 'value3', 'field4': 'valuef3'}]

Leave a comment