Re: Rounding the elements of a Python array (numarray module)

2004-12-03 Thread Chris P.
S I wasn't sure if no one replied because a) this question was too dumb or b) this question was too hard... it was definitely the former. But I'll post the answer, anyway: I forgot to keep in mind - when reading the documentation, assume that a >>> from numarray import * occurred first. So h

Rounding the elements of a Python array (numarray module)

2004-11-30 Thread Chris P.
Hi. I have a very simple task to perform and I'm having a hard time doing it. Given an array called 'x' (created using the numarray library), is there a single command that rounds each of its elements to the nearest integer? I've already tried something like >>> x_rounded = x.astype(numarray.Int