Questions tagged [indices]

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

For any set of records, indices are identifiers of which specify information of the address of each record.

Check the Wikipedia page for arrays to know more.

882 questions
0
votes
3 answers

Ambiguity between i, j indices and x, y coordinates when dealing with 2D arrays

Background: I am having a discussion with a friend regarding the correct way to refer to elements within a 2D array for something I'm designing. I was unhappy with using XNA's Point and Vector2 structs as array references because the properties of…
Joe Shanahan
  • 816
  • 5
  • 21
0
votes
3 answers

How to indicate the last indice in a PHP array?

I have a simple mail() script that sends to multiple emails dynamically by seperating the emails with commas.
khaverim
  • 3,386
  • 5
  • 36
  • 46
0
votes
2 answers

java randomize indices in an array

I have looked at Randomize or shuffle an array Randomize or shuffle an array I am not sure if this is the best approach to make. I want to randomize the indices of an array with 3 items. 12 4 5 int numbers[] = new int[3]; I tried using the…
alex
  • 398
  • 1
  • 6
  • 24
0
votes
1 answer

Mapping unique numbers to indices

Say I have a list of unique numbers (e.g. 105, 342, 432, 34, etc.) and I want to map them to indices (0,1,2,3, etc.). Is there a general way to do this? If not, assume that you know beforehand all the numbers in the list and you can hard code their…
ballaw
  • 1,489
  • 6
  • 20
  • 28
0
votes
1 answer

Sql Server queries optimization techniques

My Stored Procedure takes a very long time to execute. Can anyone suggest me what I can do to speed up the stored procedure, apart from using some good practices for writing down the queries. I've heard about creating indices, but I'm not sure what…
0
votes
1 answer

Use drawelements in OPENGL ES 1.x with .OBJ and multiple indices

I am teaching myself opengl es. I recently figured out how to parse/load a mesh from .OBJ file. I am now trying to apply a texture to it, I know I can only use one set of indices.. other than that I am lost as to the concept and code required to…
PhaTty-FU
  • 33
  • 7
-1
votes
2 answers

Correspendence between list indices originated from dictionary

I wrote the below code working with dictionary and list: d = computeRanks() # dictionary of id : interestRank pairs lst = list(d) # tuples (id, interestRank) interestingIds = [] for i in range(20): # choice randomly 20 highly ranked ids choice =…
xralf
  • 3,312
  • 45
  • 129
  • 200
-1
votes
0 answers

list indices must be integers or slices, not numpy.float64 for recomendation of movies based on rating

for userID, curUser in user_Group: # Create a temp that stores every movie's rating temp = [0]*len(movies_df) # For each movie in curUser's movie list for num, movie in curUser.iterrows(): # Divide the rating by 5 and…
-1
votes
2 answers

How to find the greatest values in a list and the corresponding values to that in another list?

I have two lists that have the same amount of elements. Each element is a number (float). I need to find the 10 greatest values in the first list, then find those values in the second list that have the same indices as the indices of the 10 greatest…
Vikih
  • 9
  • 2
-1
votes
1 answer

Make a new list with a certain order, but skip some indices on if condition

I am trying to make an new list in a certain order that relies on another list. It should make an list with an order i specifed, but if an item in that other list is x it should skip that index and continue with the order without skipping an item in…
Jompert
  • 3
  • 2
-1
votes
1 answer

Why do python list slices extend beyond the length of a list?

I was trying to use list slices earlier in python, and came across a strange case where I was expecting a particular list slice to cause an error. Take for instance a list, a, with the following elements. >>> a = [1,2,3,4] >>> a[0:4] >>>…
benj
  • 29
  • 3
-1
votes
2 answers

identifying indices(java)

it makes me sick ..can you help me with this one? my problem is to identify the whitespaces on my java program and the indices of it but i dont know how to identify the indices(JAVA). heres my code: import java.util.*; public class…
pj llanes
  • 1
  • 2
-1
votes
1 answer

Python Flask TypeError: string indices must be integers

Using Python Flask I want to take data from an Excel file and pass the content of each column to the html and use it to create a graph using chart.js, but the error I am facing is string indices must be integers. @app.route('/data',methods =…
-1
votes
2 answers

how do i use more than 1 list index?

how do i use more than 1 list index? like i wanna search through more than just 0 without writing another line that then searches 1, that feels like a workaround This is my current code, I'm using an API that then I put into a json >result =…
-1
votes
1 answer

Move random starting index of Excel matrix cells to the origin using C#?

I am reading an Excel document grid (Matrix) cell by cell in order to write them in another Excel document. The reading is done starting from a specific cell at some position and stops at some other specific position for example from cell A3 to A5…