maximum value in a column of file

Fredrik Lundh fredrik at pythonware.com
Wed Jul 23 08:55:49 EDT 2008


maurizio wrote:

> thank you for your answer
> actually i've to do some statistics (maximum,minimum,mean,standard 
> deviation,....) of a file of data in which each column is a particular 
> type of data. (the file is a tab separated value).
> I was trying to do this by using python (usually i work with fortran or 
> bash, but i'm learning python), that the reason why i tried to use numpy.

As I implied, you can do all this in standard Python "by hand", but 
numpy/scipy can definitely make things easier.  There's a dependency 
cost here (your program needs one or more extra libraries to work), but 
if that's no problem in your environment, I'd recommend that approach.

The scipy add-on contains a bunch of things for file i/o; see

     http://www.scipy.org/doc/api_docs/SciPy.io.html

for an overview.  Since you're reading text files, the "array_import" 
module seems to be what you need:

     http://www.scipy.org/doc/api_docs/SciPy.io.array_import.html

There are active user communities for both numpy and scipy that can help 
you sort out any remaining issues; for details, see:

     http://www.scipy.org/Mailing_Lists

Hope this helps!

</F>




More information about the Python-list mailing list