0

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 found):

timeSeriesArray = np.array(FilteredOutput[:,0])

But I am getting the following error message:

TypeError: list indices must be integers, not tuple

Why?

1
  • 1
    If you want the second column, you should probably use [:,1]. Commented Dec 31, 2010 at 8:46

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.