Thanks! But it does't work well. import numpy as np a = np.array([[1.1, 2, 3], [4, 5, 6]]) a.astype(int) b = a[0,0] / a[1,0] print b print a
the result is as follow: 0.275 [[ 1.1 2. 3. ] [ 4. 5. 6. ]] I use the notebook. 2010/10/20 Nils Bruin <[email protected]> > On Oct 19, 6:57 pm, 李季 <[email protected]> wrote: > > Dear group, > > I have a question as follow: > > > > import numpy as np > > > > B = np.array([[1, 2, 3], [4, 5, 6]]) > > > > Is there any command that I can use to convert B to a float-type? > > For more information you should probably look at the numpy manual and/ > or numpy mailing lists and newsgroups. The direct answer to your > question: > > B.astype(float) > > -- > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<sage-support%[email protected]> > For more options, visit this group at > http://groups.google.com/group/sage-support > URL: http://www.sagemath.org > -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
