Top "Indices" questions

Use this tag for questions about specifying or selecting the correct information from a structure using indices.

How to get the index of a maximum element in a NumPy array along one axis

I have a 2 dimensional NumPy array. I know how to get the maximum values over axes: >>> a = …

python numpy max indices
Access lapply index names inside FUN

Is there a way to get the list index name in my lapply() function? n = names(mylist) lapply(mylist, function(…

r lapply names indices
Find Positions of a Character in a String

How can I find a character in a String and print the position of character all over the string? For …

java string character indices
Find the indices of elements greater than x

Given the following vector, a = [1, 2, 3, 4, 5, 6, 7, 8, 9] I need to identify the indices of "a" whose elements are >= than 4, like this: …

python indexing logical-operators indices
TypeError: list indices must be integers or slices, not list

array = some kind of list with 3 columns and unlimited amount of rows with data inside of it. Volume = array[0][2] counter = 0 …

list python-3.x indices equivalent
octave error: subscript indices must be either positive integers or logicals

I'm trying to sum the product of an indexed vector and an indexed matrix like this: k=[0:1:N-1] n=[0:1:N-1] …

matlab sum sequence octave indices
TypeError: list indices must be integers, not list. How to fix?

There's the code with the TypeError in it. "list indices must be integers, not list", though they are integers. I'd …

python list typeerror indices
Python TypeError : only integer scalar arrays can be converted to a scalar index

I have made for this question an easier example of two arrays: The labelArray is a 1D-array has labels at …

python arrays numpy indices
How to resolve "IndexError: too many indices for array"

My code below is giving me the following error "IndexError: too many indices for array". I am quite new to …

python arrays machine-learning indices data-science
Indexing a numpy array with a list of tuples

Why can't I index an ndarray using a list of tuple indices like so? idx = [(x1, y1), ... (xn, yn)] X[…

numpy multidimensional-array indices