650 questions
3
votes
2
answers
71
views
I'm getting an 'index out of bounds' error using solve_ivp
I'm trying to find the outbreak time (when the number of zombies >= number of humans) as a function of the zombification rate gamma, using the following code:
arrOutbreakT = []
arrGamma = np....
0
votes
0
answers
119
views
Qwen 2.5 3B VLM Index error at the line trainer.train()
I am trying to fine-tune Qwen 2.5 3B VLM on a chess piece dataset from hugging face.
Dataset: Trelis/chess_pieces
However, im getting this index errror at the final trainer line:
IndexError ...
0
votes
1
answer
54
views
IndexError: list index out of range - for i in range(len()): not working [closed]
Version 1
farm = [["spinach", 5],["strawberry", 4]]
for i in range(len(farm)):
print([i][0], " :", [i][1], "days left")
Version 2
farm = [["spinach&...
-1
votes
1
answer
45
views
Python does not throw IndexError when evaluating if condition with 'and' operator [duplicate]
I am currently helping a friend with getting into python and I came across this snippet of code, where I was unable to understand what was happening.
def lbd_red(s):
try:
for i in range(...
0
votes
2
answers
70
views
IndexError: list index out of range in for loop while appending to list
I am trying to combine the first and last items in a list. For example, in a 10 item list, it would have items 1 and 10 combined, items 2 and 9 combined, items 3 and 8 combined, etc. (I am aware that ...
0
votes
0
answers
45
views
Index error while solving PDE's in python with 4th order of accuracy
I am trying to solve coupled heat conduction and mass diffusion for a spherical particle.
I am solving the PDE's using Finite difference method , with 4th accuracy for first and second order equations....
1
vote
1
answer
54
views
0
votes
0
answers
30
views
IndexError: index 26328703 is out of bounds for axis 0 with size 26328059
So, I am falling onto this error all the time with this project I'm doing. I am building a recommendation system based on a very large data frame, and the error occurs in this function:
def ...
0
votes
1
answer
90
views
Index Error during inference Using Roboflow Docker with cv2 using Picamera2
I'm pretty new to this so please bare with me, I'm using the roboflow library and cv2 library for my object detection model that I'm using with a docker with a raspberry pi, but I'm getting this error ...
1
vote
0
answers
26
views
ValueError Arising from Tkinter Entry
I am working on a poker game using Tkinter for the UI. Right now, when the first player folds on a round, it causes a Value Error, saying that the entry does not have a value passed in even though I ...
-4
votes
2
answers
855
views
I get a python error IndexError: Replacement index 2 out of range for positional args tuple
veriler = list()
yazarlar = list()
kitaplar = list()
sayfalar = list()
with open('veriler.csv') as file:
for i in file.readlines():
veriler.append(i[:-1])
for i in veriler:
line = i....
0
votes
1
answer
44
views
why the velocity of the ball is changing in canvas
So I was making brick break game on canvas python, I was able to create a moving ball and a moving
bar and the collision of ball to bar, now I made the code in such a way that if ball goes
down to the ...
0
votes
0
answers
27
views
Learning Python: I have an IndexError and I don't understand why [duplicate]
I'm programming a Poker game to learn Python. For my card draw I take 5 random cards out of the starting_deck list to put them in a card_on_board list and sometimes i get an IndexError.
Here is how:
...
0
votes
2
answers
122
views
Initialize List<T> with index--is this a bug?
In C# you can initialize Dictionary<TKey,TValue> like this:
var dictionary = new Dictionary<int, string>()
{
[0] = "Hello",
[1] = "World"
};
You can also ...
1
vote
1
answer
484
views
Backtrader - IndexError: list index out of range
I'm trying to load a custom data feed from a csv file that I've generated called "impact.csv" through the script below "backtrader_impact.py".
However, at "cerebro.adddata(...
0
votes
1
answer
103
views
why do I get an Error in folium.GeoJson style_funtion?
I would like to plot coordinates with folium and fill the circles according the column "type".
I tried to do this according the example given here: https://python-visualization.github.io/...
0
votes
1
answer
103
views
recursive DataFrame query
I'm writing small program to utilize data from API endpoint. As I need to solve typical problem of parent-child recursive relation I wrote function as below:
def get_client_path(client_id, _df: pd....
1
vote
2
answers
73
views
Error in Python program for converting roman numeral to integer
def romanToInt(self, s: str) -> int:
num = 0
lst = ["I","V","X","L","C","D","M"]
dict = {"I":...
1
vote
2
answers
90
views
Why does the code jump to the last line of the function?
This is a function that exports an array to an Excel spreadsheet with Panda's ExcelWriter.
Or at least it used to. It has worked fine for a few years.
Now, once it gets to the line opening the ...
0
votes
1
answer
69
views
IndexError when integrating the solution of an ODE solved with ODEint
I used odeint to solve a coupled differential equation in terms of v(t) and u(t).
f = odeint(ODEs, f0, t)
v = f[:,0]
u = f[:,1]
I want to get x, which is the integral of v(t), so I have ...
0
votes
1
answer
736
views
ImportError: cannot import name 'search' from 'googlesearch' in python
When I am importing google from googlesearch I am getting the following error.
from googlesearch import search
(...\AppData\Roaming\Python\Python39\site-packages\googlesearch\__init__.py)
ImportError: ...
0
votes
1
answer
81
views
Why is this index error occurring with MetPy?
I tried to calculate an index such as LCL using Metpy.
The following is the result of trying print(p, t, td).
[34.5 30.0 29.1 25.6 20.0 19.9 16.4 15.1 12.0 10.3 10.1] hectopascal [-56.3 -56.1 -56.9 -...
0
votes
3
answers
64
views
I keep getting indexerrors on a name generator that I wrote
The code runs just fine for a while before resulting in an index error.
This is the error message I keep getting
This is the code:
import random
import time
Male_First_Names = ['Albert', 'Arnold', '...
1
vote
1
answer
53
views
No blank line breaks when writing in a csv file - Python
This is my current code:
import csv
x = 0
with open("new.csv", mode="w") as csv_file:
fieldnames = ['Question', 'Answer']
writer = csv.DictWriter(csv_file, fieldnames=...
0
votes
0
answers
116
views
Trying to use Python focus-stacking tool: IndexError: list index out of range
I am trying to use this focus-stacking tool on a set of images that I have, but I am getting an error. Here is the command I use in my Linux terminal:
focusstack -i /projectnb/npbssmic/ac25/...
0
votes
1
answer
760
views
Convert for loop to jax.lax.scan
How does one convert the following (to accelerate compiling)?
The for loop version works with jax.jit,
import functools
import jax
import jax.numpy as jnp
@functools.partial(jax.jit, static_argnums=0)...
0
votes
0
answers
20
views
I am trying to trigger the IndexError when practicing exceptions [duplicate]
I have a task I'm attempting to solve, I can't figure why I can't trigger the Index Error exception. The instructions are to print the value at the input index and print the values at the index before ...
0
votes
0
answers
40
views
Python- Indexerror: list index out of range while defining a function
I am getting the following error when I'm running a python script which is used for pre processing csv file. The error and the code snippet is shown below. In the function get_mech_update(), the ...
0
votes
0
answers
77
views
IndexError but I do not know why its being thrown
IndexError is thrown.
I am still very new to coding, so I am not really sure what is going wrong here. I know that an IndexError is thrown when you are trying to index into a value which has none. (...
-1
votes
1
answer
172
views
Cannot replace nested list value to X due to TypeError: list indices must be integers or slices, not list error [duplicate]
I am trying to do an exercise learning Python for nested lists and I the way it works is that you have a grid, and then based on what you enter, it will replace that position with an "X". ...
-1
votes
1
answer
62
views
How do I specify Index Values in Python? IndexError: single positional indexer is out-of-bounds
I am able to load this excel worksheet properly but do not know how to specify that I want data from the entire first column to be read.
Screenshot of Code
import pandas as pd
# Load Excel sheet for ...
0
votes
0
answers
69
views
IndexError: Invalid rect index
#importing stuff
import pygame
from pygame.locals import QUIT
import random as ran
#defining variables
SNAKE_WIDTH = 50
SNAKE_HEIGHT = 50
FPS = 60
GREEN = (0, 128, 0)
WHITE = (255, 255, 255)
...
1
vote
4
answers
502
views
Getting an error name "index out of range" while playing around list in Python
I am a beginner and I am playing around a list where I have seen this error and got stuck. How can I fix it? What is the reason? Is there a solution?
row1 = ["😔", "😔", "😔&...
0
votes
1
answer
124
views
Application in Python that allows a user to play the game Bulls and Cows against a computer
Write an application in Python that allows a user to play the game Bulls and Cows against a computer.
The game works as follows: The computer chooses a 4-digit number in secret. The digits must all be ...
-1
votes
3
answers
141
views
IndexError: list index out of range error: Python
A basic error I know, but i'm unsure why its occurring after troubleshooting.
I have all_specs a list of lists:
[['2020 (70 reg)', 'SUV', '34,181 miles', '395BHP', 'Automatic', 'Electric', '1 owner'], ...
0
votes
1
answer
416
views
What should I do when encountering 'IndexError: index 0 is out of bounds for axis 0 with size 0' during training of a skin detection model on Colab?
I'm a newcomer in this field.
Recently i was training a skin detection model on Colab, and this error occurred
IndexError Traceback (most recent call last)
<ipython-...
1
vote
0
answers
32
views
Function "addcyclic": IndexError
I am using "addcyclic" function and encounter the Index Error. Error details are:
IndexError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_11852/1134487354.py in
6 m....
2
votes
2
answers
212
views
Tkinter problem while using the text widget
I have this code to make each text "clickleable", from the Text() widget that has tkinter.
However, when I run the program and click over one text I get this error message witch each ...
0
votes
1
answer
665
views
IndexError: index out of range in self while using GPT2LMHeadModel.from_pretrained("gpt2")
I am working on this question answering code and using pretrained GPT2LMHeadModel. But after tokenization when I pass the inputs and attention mask to the model it is giving index error. My code:
...
0
votes
1
answer
35
views
IndexError when Computing Maximum Distances in Brain-Strand Segmentation
I need help with this project related to brain-strand segmentation. Im using the function bellow and console keeps sending:
dist1[cont] = math.dist(p1, p2))
IndexError: list index out of range.
Please ...
1
vote
1
answer
158
views
Why am I getting NaN returned from the categorical_crossentropy which causes an index error when using pyGAD for optimizing a keras ANN parameters?
I've been trying to implement a GA to optimize the parameters of my ANN. I'm new to both of these libraries and I've used this as help to implement it https://blog.paperspace.com/train-keras-models-...
1
vote
1
answer
188
views
Plotting a sphere in 3D space with the surface colour determined by another variable
I am trying to create a 3D plot in python to display a sphere where the surface colour indicates the value of a potential on the surface. The potential is dependent on the value of theta.
Right now my ...
1
vote
2
answers
176
views
List index out of range error when I use if statement (Python)
I have a list,
text_split = [['5', '5', '12\n'], ['1', '1\n'], ['1', '2\n'], ['2', '1\n'], ['2', '3\n'], ['3', '1\n'], ['3', '2\n'], ['3', '4\n'], ['4', '2\n'], ['4', '4\n'], ['1', '2\n'], ['2', '3\n']...
1
vote
1
answer
68
views
I have a Python IndexError: list index out of range error
#display the ski from the file
for row in ski_details:
groupsTV.insert('','end', text = row[0], values= (row[1], row[2], row[3]))
When i comment out the for row in ski_details line and the ...
1
vote
0
answers
42
views
Indexer out of bounds when using Pandas apply
I am having an issue with the following code which uses pandas apply through a function that returns multiple values in a series...
def make_tonic(title):
*** function is here ****
...
0
votes
0
answers
319
views
csv indexerror: list index out of range
I have a csv file ('data_counter_1.csv') which looks like below:
N;52201261;EM3000v2;2.0;20210801000000;20210801010000;20210801010000;51.28983;15.22345;172.19.224.70;0.0.0.0;ns;
C;20210801000500;127;...
-1
votes
2
answers
435
views
Application keeps crashing and is very laggy: IndexError: index 0 is out of bounds for dimension 0 with size 0
import cv2
import argparse
import pandas as pd
from ultralytics import YOLO
import supervision as sv
import numpy as np
from supervision.tools.detections import Detections, BoxAnnotator
from ...
0
votes
0
answers
454
views
How do i fix this error IndexError: index 30 is out of bounds for axis 1 with size 30?
I am trying to carry out feature selection on the Winscosin breast cancer dataset from Kaggle. The dataset has 32 colunms. I removed the iD column and i have 31 colunms left. Counting from 1. The ...
0
votes
1
answer
66
views
Python: 'IndexError: list assignment index out of range' from 2d-List
I got the error
IndexError: list assignment index out of range
by using the following code:
expC = 0
imgC = 0
pictures = [[x for x in range(7)] for y in range(25)]
for i in experimentNames:
for ...
-1
votes
1
answer
1k
views
How to solve the Index error: tuple index out of range
I have this code for taking measurements of a human body using a web camera. But I'm keep having the following error.
Traceback (most recent call last):
File "c:/Users/user/Desktop/Body detect/...