Here is the error I can't seem to squash, dropping down my count to be one less than my actual rows fixes it, but that means it can't even read the last row. The error is coming from me attempting to parse data from my .csv I have saved in the same directory.
Here is the code that seems to be causing the issue:
margin1 = datetime.timedelta(days = 1)
margin3 = datetime.timedelta(days = 3)
margin7 = datetime.timedelta(days = 7)
df = pd.read_csv('gameDB.csv')
a = df.values
rows=len(df.index)
while (x <= rows):
print (rows)
print (x)
input("Press Enter to continue...")
csvName = str((df.iloc[x,0]))
csvRel = str((df.iloc[x,1]))
csvCal = str((df.iloc[x,2]))
from datetime import datetime
today = datetime.strptime(twiday, '%Y-%m-%d').date()
compDate = datetime.strptime(csvRel, '%Y-%m-%d').date()
print (csvName + ' ' + csvRel + ' ' + csvCal)
try:
if (today+margin7 == compDate):
#tweet = (csvName + ' releases in 7 days. Click here to add to calendar ' + csvCal)
#api.update_status(tweet)
time.sleep(10)
elif (today+margin3 == compDate):
#tweet = (csvName + ' releases in 3 days. Click here to add to calendar ' + csvCal)
#api.update_status(tweet)
time.sleep(10)
elif (today+margin1 == compDate):
#tweet = (csvName + ' releases in tomorrow. Click here to add to calendar ' + csvCal)
#api.update_status(tweet)
time.sleep(10)
elif (today == compDate):
#tweet = (csvName + ' is now released.')
#api.update_status(tweet)
time.sleep(10)
except:
continue
x += 1
And Here is the error i get
Traceback (most recent call last):
File ".\gameRelease.py", line 306, in <module>
NintendoSwitch()
File ".\gameRelease.py", line 277, in NintendoSwitch
main(system,data,color,calID)
File ".\gameRelease.py", line 270, in main
twitUpdate(tDay)
File ".\gameRelease.py", line 97, in twitUpdate
csvName = str((df.iloc[x,0]))
File "C:\Users\UmbraTytan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\indexing.py", line 1367, in __getitem__
return self._getitem_tuple(key)
File "C:\Users\UmbraTytan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\indexing.py", line 1737, in _getitem_tuple
self._has_valid_tuple(tup)
File "C:\Users\UmbraTytan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\indexing.py", line 204, in _has_valid_tuple
if not self._has_valid_type(k, i):
File "C:\Users\UmbraTytan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\indexing.py", line 1672, in _has_valid_type
return self._is_valid_integer(key, axis)
File "C:\Users\UmbraTytan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\indexing.py", line 1713, in _is_valid_integer
raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds