Mathematical Operations on Array

Bryan.Fodness@gmail.com bryan.fodness at gmail.com
Fri Apr 1 09:35:59 EDT 2011


I am loading text into an array and would like to convert the values.
from math import *
from numpy import *
from pylab import *
data=loadtxt('raw.dat')
mincos=degrees(acos(data[:,0]))
minazi=degrees(data[:,1])
minthick=data[:,2]/0.006858
I am not sure why degrees() works, but acos() does not.
I receive the following
Traceback (most recent call last):
 File "C:\ test.py", line 6, in ?
 mincos=degrees(acos(float(data[:,0])))
TypeError: only length-1 arrays can be converted to Python scalars
Can anyone tell me what I am doing wrong?


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /