Re: [Numpy-discussion] numpy input with genfromttxt()

2011-06-03 Thread Olivier Delalleau
2011/6/3 Bruce Southey > On 06/03/2011 10:33 AM, jonasr wrote: > > > > > > Bruce Southey wrote: > >> On 06/03/2011 09:33 AM, jonasr wrote: > >>> thank you very much, works much nicer and faster in comparison to the > >>> script > >>> i wrote and used before , > >>> im not that much used to lambd

Re: [Numpy-discussion] numpy input with genfromttxt()

2011-06-03 Thread Bruce Southey
On 06/03/2011 10:33 AM, jonasr wrote: > > > Bruce Southey wrote: >> On 06/03/2011 09:33 AM, jonasr wrote: >>> thank you very much, works much nicer and faster in comparison to the >>> script >>> i wrote and used before , >>> im not that much used to lambda forms but it seems quit usefull in >>> si

Re: [Numpy-discussion] numpy input with genfromttxt()

2011-06-03 Thread jonasr
Bruce Southey wrote: > > On 06/03/2011 09:33 AM, jonasr wrote: >> thank you very much, works much nicer and faster in comparison to the >> script >> i wrote and used before , >> im not that much used to lambda forms but it seems quit usefull in >> situations like this >> >> >> Olivier Delallea

Re: [Numpy-discussion] numpy input with genfromttxt()

2011-06-03 Thread Bruce Southey
On 06/03/2011 09:33 AM, jonasr wrote: thank you very much, works much nicer and faster in comparison to the script i wrote and used before , im not that much used to lambda forms but it seems quit usefull in situations like this Olivier Delalleau-2 wrote: Here's an ugly one-liner: numpy.genf

Re: [Numpy-discussion] numpy input with genfromttxt()

2011-06-03 Thread jonasr
thank you very much, works quit nice and faster in comparison to the script i wrote and used before , im not that much used to lambda forms but it seems quit usefull in situations like this Olivier Delalleau-2 wrote: > > Here's an ugly one-liner: > > numpy.genfromtxt('data.txt', converters=d

Re: [Numpy-discussion] numpy input with genfromttxt()

2011-06-03 Thread gary ruben
I think the easiest is to use an intermediate string. If your file is test.txt, In [22]: a = file('test.txt').read().replace(',','.') In [23]: import StringIO In [24]: b=genfromtxt(StringIO.StringIO(a)) In [25]: b Out[25]: array([[ 0.e+00, 1.2210e-03, 1.2210e-03, 0.00

Re: [Numpy-discussion] numpy input with genfromttxt()

2011-06-03 Thread Olivier Delalleau
Here's an ugly one-liner: numpy.genfromtxt('data.txt', converters=dict([k, lambda x: float(x.replace(',', '.'))] for k in range(len(open('data.txt').readline().strip().split() -=- Olivier 2011/6/3 jgrub > > Hello, im actually try to read in data with genfromtxt(), > i want to read in numb

[Numpy-discussion] numpy input with genfromttxt()

2011-06-03 Thread jgrub
Hello, im actually try to read in data with genfromtxt(), i want to read in numbers which are stored in a textfile like this: 0,000,0012210,0012210,001,278076 160,102539 4,00E-7 0,000,000,0024411,279297