I was using exactly the same functionality in sage this week too.
See this faq entry I just added:
* QUESTION: I'm using scipy or cvxopt or numpy from Sage and get
type errors, e.g., "TypeError: function not supported for these types,
and can't coerce safely to supported types."
* ANSWER: Redefine RealNumber to change the behavior of the Sage
preparser, so decimal literals are floats instead of Sage arbitrary
precision real numbers, for example:
sage: from scipy import stats
sage: RealNumber=float
sage: stats.ttest_ind(list([1,2,3,4,5]),list([2,3,4,5,.6]))
(array(0.076752955645333687), 0.940704902474)
--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org