Frank Energie - get lowest prices for x number of hours

I am using the Frank Energie Custom Component via HACS. It provides a list of dictionaries for each hour below a small part of the sensor (list).

[{'from': datetime.datetime(2023, 1, 8, 0, 0), 'till': datetime.datetime(2023, 1, 8, 1, 0), 'price': 0.1914}, {'from': datetime.datetime(2023, 1, 8, 1, 0), 'till': datetime.datetime(2023, 1, 8, 2, 0), 'price': 0.1879}]

Now I am trying to re-create the same list, but average the price, including the next 2 hours. So I still have for each hour a price, but it is the average of the current and next two.

An issue I expect is that I cannot create an average of the last two hours of the list, so I need to stop the loop before that situation.

I have tried to loop, but I got stuck in setting the values.

{% for i in list %}
  {% for key, value in i.items() %}
    {% set i.price = i.price + .... %}
  {% endfor %}
{% endfor %}
{{list}}

Already put in hours to get this done (yes, I know, not a coder by heart :-))

I hope someone can help me.

This is also what I came up with.

{% set parent = state_attr('sensor.current_electricity_price_all_in', 'prices') %}
{% set average_price_2 = namespace(list=[]) %}
{% for dict_item in parent %}
  {% for key, value in dict_item.items() %}
  {% set average_price_2.list = average_price_2.list + [key] %}
  {% endfor %}
{% endfor %}
{{average_price_2.list}}