Re: data type and logarithm

2011-06-16 Thread Robert Kern
On 6/16/11 12:20 PM, Terry Reedy wrote: rho = mp.append(rho, float(r)) # same with entropy) does numpy really not let you write Python stype rho.append(float(r)) ? No. numpy arrays are not extensible in-place in general because we use view semantics for slices and similar operations like tr

Re: data type and logarithm

2011-06-16 Thread Terry Reedy
On 6/16/2011 4:37 AM, simona bellavista wrote: Hi, I am quite new to python and I am trying to do some simple plots. I am using python Python 2.6.4 and numpy/1.5.1 I have an ASCII data file that I am reading with the following lines of code: import pylab import numpy as np filename='something.

Re: data type and logarithm

2011-06-16 Thread Peter Otten
simona bellavista wrote: > Hi, I am quite new to python and I am trying to do some simple plots. > I am using python Python 2.6.4 and numpy/1.5.1 > I have an ASCII data file that I am reading with the following lines > of code: > > import pylab > import numpy as np > > filename='something.dat'

Re: data type and logarithm

2011-06-16 Thread afy...@gmail.com
I tried to cast it to float by rho = float(np.append(rho,columns[0])) but I get TypeError: don't know how to convert scalar number to float By the way, if I avoid to perform the logarithm and do a plot like pylab.plot(rho, entropy) it works! Any idea? On Jun 16, 11:16 am, Nobody wrote: > A

Re: data type and logarithm

2011-06-16 Thread Nobody
On Thu, 16 Jun 2011 01:37:08 -0700, simona bellavista wrote: > print rho.dtype > print entropy.dtype > > I get |S22 , what's that? A string. You probably want to convert "columns" to floats before appending its elements to the array. -- http://mail.python.org/mailman/listinfo/python-list