Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7755

Re: data type and logarithm

From Terry Reedy <tjreedy@udel.edu>
Subject Re: data type and logarithm
Date 2011-06-16 13:20 -0400
References <b583dac8-826e-4bd5-b230-00e667855896@m24g2000yqc.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.25.1308244859.1164.python-list@python.org> (permalink)

Show all headers | View raw


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.dat'
> file = open(filename)

combine into one statement
file = open("sjlsjls.dat")

> rho = np.array([], dtype = 'float64')
> entropy = np.array([], dtype = 'float64')
> for line in file:
>      columns = line.split()

        r,e = line.split()

>      rho = np.append(rho,columns[0])
>      entropy = np.append(entropy,columns[1])

        rho = mp.append(rho, float(r)) # same with entropy)

does numpy really not let you write Python stype

        rho.append(float(r))
?

There are also numpy,scipy lists for numpy,scipy questions.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

data type and logarithm simona bellavista <afylot@gmail.com> - 2011-06-16 01:37 -0700
  Re: data type and logarithm Nobody <nobody@nowhere.com> - 2011-06-16 10:16 +0100
    Re: data type and logarithm "afylot@gmail.com" <antonella.garzilli@gmail.com> - 2011-06-16 02:27 -0700
  Re: data type and logarithm Peter Otten <__peter__@web.de> - 2011-06-16 13:55 +0200
  Re: data type and logarithm Terry Reedy <tjreedy@udel.edu> - 2011-06-16 13:20 -0400
  Re: data type and logarithm Robert Kern <robert.kern@gmail.com> - 2011-06-16 16:21 -0500

csiph-web