How to return fractional part from array of floats?

Sean Richards someone at invalid.com
Mon Mar 10 04:24:41 EST 2003


On Mon, 10 Mar 2003 09:01:53 GMT, Sean Richards wrote:

> The subject says it all. I have a Numeric array of type Float. How do I
> return an array of the fractional parts of the Floats. I know I can
> apply modf() to a single float but is there some function I am missing
> that I can apply to a complete array?

Typical - spend a lot of time trying to work something out and find the
answer minutes after you post. Sorry for the wasted bandwidth.

asarray(floatarray).astype('l') seems to do the trick.

Sean :)

-- 
+---------------------------------------------------------------+
| All spelling errors are intentional and are there to show new |
| and improved ways of spelling old words.                      |
+---------------------------------------------------------------+




More information about the Python-list mailing list