Re: [web2py] How to select a column of numbers into a list so that I can manipulate the list

2014-05-26 Thread Carlos Costa
Try:

 nums3 = db(db.Measures).select( db.Measures.measure_value,
orderby=db.Measures.measure_date_time).as_list()


2014-05-26 7:20 GMT-03:00 Syd Stewart :

> Hi
>
> What is the simplest way please to select a column of figures (floats and
> int) into a list, so I can manipulate the list e.g randomise the order
>
>  nums3 = db(db.Measures).select( db.Measures.measure_value,
> orderby=db.Measures.measure_date_time)
>
>  meannums= sum(nums3)/float(len(nums3))
>
> This calculation of the mean keeps giving me an error
>
>   File "/home/sydstewart/web2py/applications/SydOwn/controllers/test.py" 
> ,
>  line 92, in cusum
> qnum[i][k] = (nums3[k]) - (meannums)
> TypeError: unsupported operand type(s) for -: 'Row' and 'int'
>
>
> Thanks
>
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Att.

Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to select a column of numbers into a list so that I can manipulate the list

2014-05-26 Thread Syd Stewart
Hi

What is the simplest way please to select a column of figures (floats and 
int) into a list, so I can manipulate the list e.g randomise the order 

 nums3 = db(db.Measures).select( db.Measures.measure_value, 
orderby=db.Measures.measure_date_time)

 meannums= sum(nums3)/float(len(nums3))

This calculation of the mean keeps giving me an error

  File "/home/sydstewart/web2py/applications/SydOwn/controllers/test.py" 
,
 line 92, in cusum
qnum[i][k] = (nums3[k]) - (meannums)
TypeError: unsupported operand type(s) for -: 'Row' and 'int'


Thanks


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.