[Tutor] selecting data from a list
Colin Ross
colin.ross.dal at gmail.com
Sun Jan 18 01:49:30 CET 2015
Hi all,
I am attempting to isolate a certain subset of data from the list "a" and
then turn it into any array. To do so, I have written the following code:
import numpy as np
a = [0,1,2,3,4,5,6,7,8,9,10]
b = [10,20,30,40,50,60,70,80,90,100,110]
for a in range(len(a)):
if a > 5:
print a
a_1 = np.array(a)
print a_1
The output is as follows:
6
7
8
9
10
10
As you can see, when I attempt to turn the list of numbers 6 through 10
into an array I am left with it only printing out 10...
The desired result is: [6,7,8,9,10}
Any guidance would be greatly appreciated.
Thank you.
Colin
More information about the Tutor
mailing list