Re: transpose values_list result from ORM

2014-10-05 Thread Collin Anderson
Ahh, yup. values_list(). I was thinking values() -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this

Re: transpose values_list result from ORM

2014-10-05 Thread Florian Auer
Ha, I think i got it the result from my databes is a values_list with tupels that cannot be acced via name. I have to use the indizes: for kz in kzlist: data.setdefault(kz[1], {})[kz[0]] = kz[2] Am Sonntag, 5. Oktober 2014 16:07:02 UTC+2 schrieb Florian Auer: > > Hi > > the original

Re: transpose values_list result from ORM

2014-10-05 Thread Florian Auer
Hi the original variant was claiming a type mismatch: Traceback (most recent call last): File "", line 2, in TypeError: tuple indices must be integers, not str The same with your code example. Maybe the reason is that date is not an integer as it looks like, but a string representation of

Re: transpose values_list result from ORM

2014-10-02 Thread Collin Anderson
Assuming "klist" is a typo, your setdefault code _should_ give you something close to what you want, though not exactly in a table. What happens when you try? I simplified your code slightly: data = {} for kz in kzlist: # assuming klist was a typo data.setdefault(kz['date'],

transpose values_list result from ORM

2014-10-02 Thread Florian Auer
Hi I have a ORM query that results something like this: +-+-+---+ | date | key | value | +-+-+---+ | 201312 | A | 123 | | 201312 | B | 223 | | 201312 | C | 133 | | 201311 | A | 173 | | 201311 | B | 463 | | 201311 | C | 463 |