Question
Keep getting This error File C:/Users/davis/AppData/Local/Programs/Python/Python36-32/SeniorProject.py, line 74, in home_rank = dataset[dataset[Team] == home_team][Rk].values[0] IndexError: index 0 is out of bounds for axis 0 with
Keep getting This error
File "C:/Users/davis/AppData/Local/Programs/Python/Python36-32/SeniorProject.py", line 74, inhome_rank = dataset[dataset["Team"] == home_team]["Rk"].values[0] IndexError: index 0 is out of bounds for axis 0 with size 0
Code
for index, row in dataset.iterrows(): home_team = row["Home Team"] visitor_team = row["Visitor Team"] row["Home Win Streak"] = win_streak[home_team] row["Visitor Win Streak"] = win_streak[visitor_team] dataset.ix[index] = row # Set current win if row["Home Team Win"]: win_streak[home_team] += 1 win_streak[visitor_team] = 0 else: win_streak[home_team] = 0 win_streak[visitor_team] += 1
dataset["Home Team Ranks Higher"] = 0 for index , row in dataset.iterrows(): home_team = row["Home Team"] visitor_team = row["Visitor Team"] home_rank = dataset[dataset["Team"] == home_team]["Rk"].values[0] visitor_rank = standing[standing["Team"] == visitor_team]["Rk"].values[0] row["Home Team Rank Higher"] = int(home_rank > visitor_rank) dataset.ix[index] = row
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started