Ok, So I have a 2-d array of data which has the shape(23025, 1000), it’s called ‘allfiles’.
I need to go through the array 50 columns at a time and extract them to a sub-array for manipulation. The problem is when i address the array using the code below, it doesn’t seem to recognize the variables (a and b). the code i have at the moment is shown below.
q = 50
a = np.shape(allfiles)[1] # a = 1000
for i in range(a):
b = a + q
data = allfiles[:,a:b]
When i replace the variables with number, i.e…
data = allfiles[:,30:80]
It seems to work. So, my question is – is there a way i can pass variables to the array index? If not is there a better way i can create a subarray using variables?
I have tried to find this problem on stack overflow with no luck, but i’m sure i’m not the first person to have this trouble?
Cheers guys,
Morgan
You are getting
ifrom the loop but don’t use it.