I have a 2D numpy array, FilteredOutput
, that has 2 columns and 10001 rows, though the number of rows is a variable.
I am trying to take the 2nd column of FilteredOutput
and use it to populate a new 1D numpy array called timeSeriesArray
using some code I fo开发者_如何学JAVAund):
timeSeriesArray = np.array(FilteredOutput[:,0])
But I am getting the following error message:
TypeError: list indices must be integers, not tuple
Why?
This is solved now. The problem was that I had not explicitly declared FilteredOutput to be a numpy array inside the function. I thought it had been declared as a numpy array outside the function, but the problem was solved when I added
FilteredOutput = np.array(FilteredOutput)
before
timeSeriesArray = np.array(FilteredOutput[:,0])
note: numpy
is imported as np
精彩评论