Cast problems .... doo dah, doo dah
![](https://secure.gravatar.com/avatar/90b570d6a05bef5779fd32080fab0064.jpg?s=120&d=mm&r=g)
Sept. 25, 2002
5:24 p.m.
The following code produces an error --------------------------------------- a=array(([1,2,3,4,5],[10,9,8,7,6])).astype(Float32) cond=array(([0,0,0,0,0],[1,1,1,1,1]) b=array(([0,0,0,0,0],[0,0,0,0,0])) choose(cond,(a,b)) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: Array can not be safely cast to required type ------------------------------ I suppose I might need to cast b to Float32. But, I have a function which is passed a and b as args. Ideally, I would like a function which casts a and b to the highest compatible type since "choose" doesnt do it. How can I do this simply? Mathew -- M47h3w `/34735
8180
Age (days ago)
8180
Last active (days ago)
0 comments
1 participants
participants (1)
-
Mathew Yeates