[Numpy-discussion] first post, simple questions

R. Bastian rbastian@free...
Thu Aug 21 12:53:38 CDT 2008


On Thu, 21 Aug 2008 10:40:47 -0700 (PDT)
Prashant Saxena <animator333@yahoo.com> wrote:

> Hi,
> 
> numpy rocks!!!
> 
> import numpy
> linsp = numpy.linspace
> red = linsp(0, 255, 50)
> green = linsp(125, 150, 50)
> blue = linsp(175, 255, 50)
> 
> array's elements are float. How do I convert them into integer?
> 
> I need to build a new array from red, green, blue. like this:
> 
> [[ red[0], green[0], blue[0] ],
>  [ red[1], green[1], blue[1] ],
>  [ red[2], green[3], blue[3] ],
>  ....
>  ....
>  [ red[49], green[49], blue[49] ],
> ]
> 
> how do I create such an array?
> 
> Are there any issues regarding compilation of simple python scripts using numpy functions and cython?
> 
> Thanks

1. read the doc
2. use 'astype' and 'array([.... tra la la ... ])

-- 
R. Bastian 
www.musiques-rb.org
http://www.centrotemporeale.it/index.php?lang=it&sez=news&id=20080926



More information about the Numpy-discussion mailing list