[Python] Aggregating and calculating in OrderedDict in Python

Discussão em 'Python' iniciado por Stack, Dezembro 8, 2024.

  1. Stack

    Stack Membro Participativo

    Have a OrderedDict "d" looking like that:

    [OrderedDict([
    ('id', '1'),
    ('date', '20170101'),
    ('quantity', '10')]),
    OrderedDict([
    ('id', '2'),
    ('date', '20170102'),
    ('quantity', '3')]),
    OrderedDict([
    ('id', '3'),
    ('date', '20170102'),
    ('quantity', '1')])]


    I'm trying to do the group by 'date' and calculating the sum of quantity and display these two columns 'date' and 'sum_quantity'. How can I do that not using pandas groupby options?

    Thanks!

    Continue reading...

Compartilhe esta Página