Your output
variable is not a N x 4
matrix, at least not in python types sense. It is a tuple, which can only be indexed by a single number, and you try to index by tuple (2 numbers with coma in between), which works only for numpy matrices. Print your output, figure out if the problem is just a type (then just convert to np.array) or if you are passing something completely different (then fix whatever is producing output
).
Example of what is happening:
import numpy as np output = ((1,2,3,5), (1,2,1,1)) print output[1, 2] # your error print output[(1, 2)] # your error as well - these are equivalent calls print output[1][2] # ok print np.array(output)[1, 2] # ok print np.array(output)[(1, 2)] # ok print np.array(output)[1][2] # ok
Related Posts:
- Python Pandas: Get index of rows which column matches certain value
- Python Pandas: Get index of rows which column matches certain value
- Append a tuple to a list – what’s the difference between two ways?
- How to reset index in a pandas dataframe? [duplicate]
- IndexError: too many indices for array
- IndexError: too many indices for array
- Finding the index of an item in a list
- What is an index in SQL?
- Finding the index of an item in a list
- TypeError: ‘float’ object is not subscriptable
- Double precision floating values in Python?
- TypeError: ‘float’ object is not subscriptable
- Convenient way to deal with ValueError: cannot reindex from a duplicate axis
- What are “named tuples” in Python?
- Double precision floating values in Python?
- What’s the canonical way to check for type in Python?
- IndexError: too many indices for array
- django: TypeError: ‘tuple’ object is not callable
- TypeError: ‘float’ object is not callable
- Python convert tuple to string
- Error”Can only compare identically-labeled Series objects” and sort_index
- Convert list to tuple in Python
- Index Error: list index out of range (Python) [duplicate]
- TypeError: ‘str’ object cannot be interpreted as an integer [duplicate]
- What is dtype(‘O’), in pandas?
- What is dtype(‘O’), in pandas?
- How to determine a Python variable’s type?
- Change column type in pandas
- Python: find position of element in array
- Determine the type of an object?
- How to remove an element from a list by index
- Python add item to the tuple
- Python: tuple indices must be integers, not str when selecting from mysql table
- How to index into a dictionary?
- Pop index out of range
- Get first row value of a given column
- How to check if type of a variable is string?
- What does ‘index 0 is out of bounds for axis 0 with size 0’ mean?
- What does ‘index 0 is out of bounds for axis 0 with size 0’ mean?
- How to sort a list/tuple of lists/tuples by the element at a given index?
- Add Variables to Tuple
- What’s the difference between lists enclosed by square brackets and parentheses in Python?
- Why is there no tuple comprehension in Python?
- Why is there no tuple comprehension in Python?
- Pandas split DataFrame by column value
- Python AttributeError: ‘dict’ object has no attribute ‘append’
- How does tuple comparison work in Python?
- What datatype should be used for storing phone numbers in SQL Server 2005?
- How to convert index of a pandas dataframe into a column
- TypeError: can only concatenate tuple (not “str”) to tuple Error
- creating sets of tuples in python
- How to print a specific row of a pandas DataFrame?
- TypeError: can only concatenate tuple (not “int”) in Python
- Conditional indexing with Numpy ndarray
- Can I put a tuple into an array in python?
- Python convert tuple to string
- Does Python have an immutable list?
- SyntaxError: unexpected EOF while parsing
- How do I lowercase a string in Python?
- How do I copy a file in Python?
- How can I reverse a list in Python?
- Manually raising (throwing) an exception in Python
- How do I copy a file in Python?
- can’t multiply sequence by non-int of type ‘float’
- Difference between del, remove, and pop on lists
- How can I reverse a list in Python?
- How to use the pass statement
- How to use filter, map, and reduce in Python 3
- What does enumerate() mean?
- Searching the student-t distribution table for values using python
- How to declare an array in Python?
- Does Python have a ternary conditional operator?
- Use Gif Logo For Loading Screen In Kivy
- Praw & Discord.py: The bot keep sending the same meme. I want the bot to send different meme whenever it is asked
- Pig Latin Translator
- What is the difference between Python’s list methods append and extend?
- How can I make a time delay in Python? [duplicate]
- Python – TypeError: ‘int’ object is not iterable
- TypeError: ‘int’ object is not subscriptable
- sphinx.ext.autodoc: Keeping names of constants in signature
- are there dictionaries in javascript like python?
- How do you round UP a number?
- Understanding slice notation
- Iterating over dictionaries using ‘for’ loops
- How to define a two-dimensional array?
- how to sort pandas dataframe from one column
- Why am I seeing “TypeError: string indices must be integers”?
- Understanding the main method of python [duplicate]
- How do you round UP a number?
- Understanding slice notation
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- How do I update\upgrade pip itself from inside my virtual environment?
- How to open a file using the open with statement
- How to emulate a do-while loop?
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- How do I update\upgrade pip itself from inside my virtual environment?
- How to comment out a block of code in Python [duplicate]
- Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)
- Using “with open() as file” method, how to write more than once? [duplicate]
- TypeError: list indices must be integers or slices, not str