Iterating over columns of dataframe and print as rows in Python Django

Posted by Poster under Python on 12/8/2021 | Points: 10 | Views : 4584 | Status : [Member] | Replies : 0
I had huge number of columns in the datasource from where Pandas was reading and sending DataFrame to Django template. My requirement was to list those columns as rows with column name and value.

After a lot of struggle, found this solution

<table class="table table-striped" id="tableS">
{% for rowIndex, row in data.iterrows %}
{% for columnIndex, value in row.items %}
{% endfor %}
{% endfor %}


(No response found.)

Login to post response