Sep-15-2020, 09:32 PM
I have changed the code and I know I am creating a list. But when I go to print out list I get an error. Don't understand why. I know what it says at end of error, but doesn't make sense to me.
Error:
Milford@LAPTOP-3NUEM60C MINGW64 /c/guis
$ python testloop.py
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 1883, in __call__
return self.func(*args)
File "testloop.py", line 135, in select_track
load_track_to_Handi()
File "testloop.py", line 94, in load_track_to_Handi
xx = np.array(df.iloc[hcount,18:19 ])
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexing.py", line 873, in __getitem__
return self._getitem_tuple(key)
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexing.py", line 1443, in _getitem_tuple
self._has_valid_tuple(tup)
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexing.py", line 702, in _has_valid_tuple
self._validate_key(k, i)
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexing.py", line 1352, in _validate_key
self._validate_integer(key, axis)
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexing.py", line 1437, in _validate_integer
raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds
I don't understand why I'd have an index error.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
def load_track_to_Handi(): my_tracklabel = Label(root, text = " " , fg = "#F50808" , font = ( "sans_serif" , 16 )).place(x = 380 , y = 430 ) read_csvfile_into_array() global track_abrev global race_number global xx #if fileFound ==True: sortedArr = [] x = [] hcount = 0 csv_reader = csv.reader(race_file) #for line in race_file: #print(line) df = pd.read_csv(race_file, header = None ) for i in df: #if int(np.array(df.iloc[hcount, 1:2 ])) < int(race_number): xx = np.array(df.iloc[hcount, 18 : 19 ]) #xx = (hcount,int(x)) sortedArr.append(xx) hcount + = 1 for i in range ( 0 , len (sortedArr)): print (sortedArr[i]) |
Milford@LAPTOP-3NUEM60C MINGW64 /c/guis
$ python testloop.py
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 1883, in __call__
return self.func(*args)
File "testloop.py", line 135, in select_track
load_track_to_Handi()
File "testloop.py", line 94, in load_track_to_Handi
xx = np.array(df.iloc[hcount,18:19 ])
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexing.py", line 873, in __getitem__
return self._getitem_tuple(key)
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexing.py", line 1443, in _getitem_tuple
self._has_valid_tuple(tup)
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexing.py", line 702, in _has_valid_tuple
self._validate_key(k, i)
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexing.py", line 1352, in _validate_key
self._validate_integer(key, axis)
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexing.py", line 1437, in _validate_integer
raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds
I don't understand why I'd have an index error.