Re: [Tutor] create numpy array from list of strings

2008-06-04 Thread Kent Johnson
On Tue, Jun 3, 2008 at 10:35 PM, washakie <[EMAIL PROTECTED]> wrote: > I guess I assumed there would be a way to 'nest' list > comprehension somehow. Sure, just nest them. You have: tempDATA=[] for i in data[stind:-1]: tempDATA.append([float(j) for j in i.split()]) This has the form tem

Re: [Tutor] create numpy array from list of strings

2008-06-03 Thread Danny Yoo
On Tue, 3 Jun 2008, washakie wrote: 2) I've done the following, but I doubt it is the most efficient method: Is there a better way? This looks good. Wow, really? I guess I assumed there would be a way to 'nest' list comprehension somehow. I'm assuming you already have good familiarity w

Re: [Tutor] create numpy array from list of strings

2008-06-03 Thread washakie
Thank you again. I can see your point about not wanting the tempDATA var hanging around, so I guess this is better as a function. And yes, the transpose is for the 'next step' - sorry if that cause anyone confusion. Danny Yoo-3 wrote: > > > If you already have the values as a list of rows, w

Re: [Tutor] create numpy array from list of strings

2008-06-03 Thread Danny Yoo
I actually thought this would be as simple as the 'load' command to get the data in from a file. But I just couldn't find the documentation online to do it once i have the data already 'inside' of python as a list. So, my options are: Hello, If you already have the values as a list of rows, w

Re: [Tutor] create numpy array from list of strings

2008-06-03 Thread washakie
Thanks, I'm not really trying to create a function. I actually thought this would be as simple as the 'load' command to get the data in from a file. But I just couldn't find the documentation online to do it once i have the data already 'inside' of python as a list. So, my options are: 1) write

Re: [Tutor] create numpy array from list of strings

2008-06-03 Thread Danny Yoo
Hello, I have a list of strings: data = [ '33386.472.22-1.11 0.43' '33386.67 3.33 -1.23 0.54' ... '46728.470.1-1.87-0.54' '46728.479.75.680.38' '46729.47-0.17-0.470.23'] I wish to convert it to a numpy array of floats. How do I accomplish th

Re: [Tutor] create numpy array from list of strings

2008-06-03 Thread bob gailer
washakie wrote: Hello, I have a list of strings: data = [ '33386.472.22-1.11 0.43' '33386.67 3.33 -1.23 0.54' ... '46728.470.1-1.87-0.54' '46728.479.75.680.38' '46729.47-0.17-0.470.23'] If the above is intended to be Python code, it ha

[Tutor] create numpy array from list of strings

2008-06-03 Thread washakie
Hello, I have a list of strings: data = [ '33386.472.22-1.11 0.43' '33386.67 3.33 -1.23 0.54' ... '46728.470.1-1.87-0.54' '46728.479.75.680.38' '46729.47-0.17-0.470.23'] I wish to convert it to a numpy array of floats. How do I accomplish t