Problem with data hash only storing last entry in loop 1: I'm creating a data hash object and then looping through a collection of entries to store the results of various macros in it: 

{% set data = {} %}
{% set people = craft.entries().section('people').all() %}


2: I'm setting a reference to each entry and then merging the content compiled into my data object: 

{% for person in people %}
    {% set i = loop.index %}

    {# get and set key|values #}

     {% set data = data|merge({
        i: {
            "key": value, 
            "otherKey":  otherValue
        }
    }) %}
{% endfor %}


3: And then I'm looping through my data object for output:

{% for row in data %}
    &lt;tr&gt;
        &lt;td&gt;{{ row.key|raw }}&lt;/td&gt;
        &lt;td&gt;{{ row.otherKey|raw }}&lt;/td&gt;
    &lt;/tr&gt;
{% endfor %}


The structure of the output at stage 3 is fine, but it's only resulting in 1 row out of 45 people entries.

What am I doing wrong at 2 please?
For the hash key to be dynamic, you must wrap it in parentheses:

(i): {