Pivot Table/Groupby/Sum question

John Machin sjmachin at lexicon.net
Sat Dec 29 03:28:36 EST 2007


On Dec 29, 11:51 am, patrick.wa... at gmail.com wrote:

> John would you mind walking me through your class in normal speak?

Yes.

> I
> only have a vague idea of why it works and this would help me a lot to
> get a grip on classes and this sort of particular problem.

It's about time you got a *concrete* idea of how something works. Grab
a pencil and a large piece of paper, pretend you are python.exe and
follow through what happens when it executes
    ptab = SimplePivotTable(.......)
and the ptab.add_item(......) loop with this set of data:
    data = [
        ['Bob', 'Morn', 240],
        ['Bob', 'Aft',  300],
        ['Bob', 'Morn',  40],
        ]
with the goal of being able to say what is in ptab.cell_dict and
understanding how it got there.

Cheers,
John



More information about the Python-list mailing list