1👍
I’m assuming this is happening because you’re passing a dataframe. You need to convert the data to a list and pass it to a dictionary. I give an example where the dataframe is converted to a list: df[‘time’].values.
‘bboard’ replace with the folder where your template is located.
views.py
import pandas as pd
def home(request):
df_gb = pd.DataFrame({'time': [1, 2, 3, 4, 5, 1, 2, 3, 4]})
context = {'df': df_gb['time'].values}
return render(request, 'bboard/rank_templ.html', context)
templates(rank_templ.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
</head>
<body>
{% for i in df %}
<ul class="list-group">
<li class="list-group-item">C/O: <span class="badge bg-primary rounded-pill">{{i}}
</span></li>
</ul>
{% endfor %}
</body>
</html>
Output
Source:stackexchange.com