{% macro table(table_data, context) %} {% set groupby = context["groupby"] %} {% set context_key = groupby + 's' %} {% for title, data in table_data.items() %} {% if context[context_key].get(title) %}

{{ context[context_key][title].name or context[context_key][title].id }}

{% if groupby != 'model' %} {% endif %} {% for metric in data.columns %} {% endfor %} {% for model, row in data.iterrows() %} {% if groupby != 'model' %} {% endif %} {% for _, value in row.items() %} {% endfor %} {% endfor %}
Model{{ metric }}
{{model}}{{ value }}
{% endif %} {% endfor %} {% endmacro %}