load() arguments

does pylab.load('data.txt') support other
ASCII data formats than the following?

    4.6 3.1 1.5 0.2
    4.6 3.4 1.4 0.3
    5.4 3.7 1.5 0.2
    5.8 4.0 1.2 0.2
    5.4 3.9 1.3 0.4

...like:

    4.6;3.1;1.5;0.2
    4.6;3.4;1.4;0.3
    5.4;3.7;1.5;0.2
    5.8;4.0;1.2;0.2
    5.4;3.9;1.3;0.4

    4.6, 3.1, 1.5, 0.2
    4.6, 3.4, 1.4, 0.3
    5.4, 3.7, 1.5, 0.2
    5.8, 4.0, 1.2, 0.2
    5.4, 3.9, 1.3, 0.4

etc.

R http://www.r-project.org/, has a nice solution for this:

x <- read.table(file="data.txt", sep=";", dec=".", quote="\"")

scipy.io.read_array will do this

read_array(fileobject, separator=None, columns=None, comment='#', lines=None, at
ype='d', linesep='\n', rowsize=10000, missing=0)

Vidar Gundersen wrote:

···

does pylab.load('data.txt') support other
ASCII data formats than the following?

   4.6 3.1 1.5 0.2
   4.6 3.4 1.4 0.3
   5.4 3.7 1.5 0.2
   5.8 4.0 1.2 0.2
   5.4 3.9 1.3 0.4

...like:

   4.6;3.1;1.5;0.2
   4.6;3.4;1.4;0.3
   5.4;3.7;1.5;0.2
   5.8;4.0;1.2;0.2
   5.4;3.9;1.3;0.4

   4.6, 3.1, 1.5, 0.2
   4.6, 3.4, 1.4, 0.3
   5.4, 3.7, 1.5, 0.2
   5.8, 4.0, 1.2, 0.2
   5.4, 3.9, 1.3, 0.4

etc.

R http://www.r-project.org/, has a nice solution for this:

x <- read.table(file="data.txt", sep=";", dec=".", quote="\"")

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

does pylab.load('data.txt') support other
ASCII data formats than the following?

    4.6 3.1 1.5 0.2
    4.6 3.4 1.4 0.3
    5.4 3.7 1.5 0.2
    5.8 4.0 1.2 0.2
    5.4 3.9 1.3 0.4

...like:

    4.6;3.1;1.5;0.2
    4.6;3.4;1.4;0.3
    5.4;3.7;1.5;0.2
    5.8;4.0;1.2;0.2
    5.4;3.9;1.3;0.4

x=load('foo.dat', delimiter=';')

    4.6, 3.1, 1.5, 0.2
    4.6, 3.4, 1.4, 0.3
    5.4, 3.7, 1.5, 0.2
    5.8, 4.0, 1.2, 0.2
    5.4, 3.9, 1.3, 0.4

y=load('bar.dat', delimiter=',')

Darren

···

On Wednesday 06 July 2005 7:08 am, Vidar Gundersen wrote:

I forgot to add that the option to specify a delimiter was introduced in
matplotlib-0.81

Darren

···

On Wednesday 06 July 2005 8:47 am, Darren Dale wrote:

y=load('bar.dat', delimiter=',')