>> instead of:
>>
>> header1              header2              header3
>> value_row1         value_row1         value_row1
>> value_row2         value_row2         value_row2
>>
>> I would like to have:
>>
>> header1    value_row1     value_row2
>> header2    value_row1     value_row2
>> header3    value_row1     value_row2
>>

> itertools could help if you have a big resultset:
> 
> In [1]: l = [                                   
>    ....: ('h1row1','h2row1','h3row1'),
>    ....: ('h1row2','h2row2','h3row2'),
>    ....: ('h1row3','h2row3','h3row3')
>    ....: ]
> 
> In [2]: import itertools
> 
> In [3]: for val in itertools.imap(list, itertools.izip(*l)):
>    ...:     print val
>    ...:     
>    ...:     
> ['h1row1', 'h1row2', 'h1row3']
> ['h2row1', 'h2row2', 'h2row3']
> ['h3row1', 'h3row2', 'h3row3']

Hello,
thanks very much for your response!

I was more thinking of something like:

In [1]: import numpy as np

In [2]: a = np.zeros(10)

In [3]: a
Out[3]: array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.])

In [4]: resh = a.reshape(2,5)

In [5]: resh
Out[5]:
array([[ 0.,  0.,  0.,  0.,  0.],
        [ 0.,  0.,  0.,  0.,  0.]])

In [6]: transp = resh.transpose()

In [7]: transp
Out[7]:
array([[ 0.,  0.],
        [ 0.,  0.],
        [ 0.,  0.],
        [ 0.,  0.],
        [ 0.,  0.]])

Promt [5] / resh shows the default output of SQLTABLE. I would like to 
have [7] / transp.

I think the quickest would be if I read the result of the query into an 
string array and then transpose it and convert back to with transp.tolist().

Rebuilding the table with the header, rows format in the view by using a 
hand-made HTML table is not in the elegant style of web2py.

But I will try yours and see what I get.

Regards,
Timmie


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to