Project Description
With this tool, one can look at different NBA teams and player together with their stats. It also looks at the opposing team and returns all of the relevant statistics (passes, shoots, points, assits, rebounds, etc.). It can also look further statistics such as future matches. There it calculates most likely statistics for a given player based on past data. It is possible to expand this model to calculate chance of winning, based on past matches and past statistics. All this had been done using Python. Data is scraped from nba.com using nba_py scrapper and interactive tool is made using Tkinter.
Below is a sample video of the program:
Code
This is not whole code. Most parts are omitted because otherwise code would be too long. Overall there are around slightly less than 2000 lines. Here I display 800 of them.
from __future__ import division
import scipy.stats as sct
import numpy as np
import pandas as pd
from Tkinter import *
import random
####################################
## import everything
####################################
from nba_py import _api_scrape, _get_json, HAS_PANDAS
from nba_py import constants
class PlayerNotFoundException(Exception):
pass
------------------------ data omitted
class PlayerYearOverYearSplits(_PlayerDashboard):
"""
Displays player stats over the given season and over all seasons in the
given league
Args:
:player_id: ID of the player to look up
:team_id: ID of the team to look up
:measure_type: Specifies type of measure to use (Base, Advanced, etc.)
:per_mode: Mode to measure statistics (Totals, PerGame, Per36, etc.)
:plus_minus: Whether or not to consider plus minus (Y or N)
:pace_adjust: Whether or not to pace adjust stats (Y or N)
:rank: Whether or not to consider rank (Y or N)
:league_id: ID for the league to look in (Default is 00)
:season: Season given to look up
:season_type: Season type to consider (Regular / Playoffs)
:po_round: Playoff round
:outcome: Filter out by wins or losses
:location: Filter out by home or away
:month: Specify month to filter by
:season_segment: Filter by pre/post all star break
:date_from: Filter out games before a specific date
:date_to: Filter out games after a specific date
:opponent_team_id: Opponent team ID to look up
:vs_conference: Filter by conference
:vs_division: Filter by division
:game_segment: Filter by half / overtime
:period: Filter by quarter / specific overtime
:shot_clock_range: Filter statistics by range in shot clock
:last_n_games: Filter by number of games specified in N
Attributes:
:json: Contains the full json dump to play around with
"""
_endpoint = 'playerdashboardbyyearoveryear'
def by_year(self):
return _api_scrape(self.json, 1)
class PlayerCareer:
"""
Contains stats based on several parameters such as career regular season
totals, post season career totals, all star season careers totals, college
season career totals, etc.
Args:
:player_id: Player ID to look up
:per_mode: Mode to measure statistics (Totals, PerGame, Per36, etc.)
:league_id: ID for the league to look in (Default is 00)
Attributes:
:json: Contains the full json dump to play around with
"""
_endpoint = 'playercareerstats'
def __init__(self,
player_id,
per_mode=constants.PerMode.PerGame,
league_id=constants.League.NBA):
self.json = _get_json(endpoint=self._endpoint,
params={'PlayerID': player_id,
'LeagueID': league_id,
'PerMode': per_mode})
def regular_season_totals(self):
return _api_scrape(self.json, 0)
def regular_season_career_totals(self):
return _api_scrape(self.json, 1)
def post_season_totals(self):
return _api_scrape(self.json, 2)
def post_season_career_totals(self):
return _api_scrape(self.json, 3)
def all_star_season_totals(self):
return _api_scrape(self.json, 4)
def career_all_star_season_totals(self):
return _api_scrape(self.json, 5)
def college_season_totals(self):
return _api_scrape(self.json, 6)
def college_season_career_totals(self):
return _api_scrape(self.json, 7)
def preseason_season_totals(self):
return _api_scrape(self.json, 8)
def preseason_career_totals(self):
return _api_scrape(self.json, 9)
def regular_season_rankings(self):
return _api_scrape(self.json, 10)
def post_season_rankings(self):
return _api_scrape(self.json, 11)
class PlayerProfile(PlayerCareer):
"""
Contains a more in depth version of player career stats with season highs,
career highs, and when the player's next game is
Args:
:player_id: Player ID to look up
:per_mode: Mode to measure statistics (Totals, PerGame, Per36, etc.)
:league_id: ID for the league to look in (Default is 00)
Attributes:
:json: Contains the full json dump to play around with
"""
_endpoint = 'playerprofilev2'
def season_highs(self):
return _api_scrape(self.json, 12)
def career_highs(self):
return _api_scrape(self.json, 13)
def next_game(self):
return _api_scrape(self.json, 14)
class PlayerGameLogs:
"""
Contains a full log of all the games for a player for a given season
Args:
:player_id: ID of the player to look up
:league_id: ID for the league to look in (Default is 00)
:season: Season given to look up
:season_type: Season type to consider (Regular / Playoffs)
Attributes:
:json: Contains the full json dump to play around with
"""
_endpoint = 'playergamelog'
def __init__(self,
player_id,
league_id=constants.League.NBA,
season=constants.CURRENT_SEASON,
season_type=constants.SeasonType.Regular):
self.json = _get_json(endpoint=self._endpoint,
params={'PlayerID': player_id,
'LeagueID': league_id,
'Season': season,
'SeasonType': season_type})
def info(self):
return _api_scrape(self.json, 0)
class PlayerShotTracking(_PlayerDashboard):
"""
Tracking data for shooting for a given player
Args:
:player_id: ID of the player to look up
:team_id: ID of the team to look up
:measure_type: Specifies type of measure to use (Base, Advanced, etc.)
:per_mode: Mode to measure statistics (Totals, PerGame, Per36, etc.)
:plus_minus: Whether or not to consider plus minus (Y or N)
:pace_adjust: Whether or not to pace adjust stats (Y or N)
:rank: Whether or not to consider rank (Y or N)
:league_id: ID for the league to look in (Default is 00)
:season: Season given to look up
:season_type: Season type to consider (Regular / Playoffs)
:po_round: Playoff round
:outcome: Filter out by wins or losses
:location: Filter out by home or away
:month: Specify month to filter by
:season_segment: Filter by pre/post all star break
:date_from: Filter out games before a specific date
:date_to: Filter out games after a specific date
:opponent_team_id: Opponent team ID to look up
:vs_conference: Filter by conference
:vs_division: Filter by division
:game_segment: Filter by half / overtime
:period: Filter by quarter / specific overtime
:shot_clock_range: Filter statistics by range in shot clock
:last_n_games: Filter by number of games specified in N
Attributes:
:json: Contains the full json dump to play around with
"""
_endpoint = 'playerdashptshots'
def general_shooting(self):
return _api_scrape(self.json, 1)
def shot_clock_shooting(self):
return _api_scrape(self.json, 2)
def dribble_shooting(self):
return _api_scrape(self.json, 3)
def closest_defender_shooting(self):
return _api_scrape(self.json, 4)
def closest_defender_shooting_long(self):
return _api_scrape(self.json, 5)
def touch_time_shooting(self):
return _api_scrape(self.json, 6)
class PlayerReboundTracking(_PlayerDashboard):
"""
Tracking data for rebounding for a given player
Args:
:player_id: ID of the player to look up
:team_id: ID of the team to look up
:measure_type: Specifies type of measure to use (Base, Advanced, etc.)
:per_mode: Mode to measure statistics (Totals, PerGame, Per36, etc.)
:plus_minus: Whether or not to consider plus minus (Y or N)
:pace_adjust: Whether or not to pace adjust stats (Y or N)
:rank: Whether or not to consider rank (Y or N)
:league_id: ID for the league to look in (Default is 00)
:season: Season given to look up
:season_type: Season type to consider (Regular / Playoffs)
:po_round: Playoff round
:outcome: Filter out by wins or losses
:location: Filter out by home or away
:month: Specify month to filter by
:season_segment: Filter by pre/post all star break
:date_from: Filter out games before a specific date
:date_to: Filter out games after a specific date
:opponent_team_id: Opponent team ID to look up
:vs_conference: Filter by conference
:vs_division: Filter by division
:game_segment: Filter by half / overtime
:period: Filter by quarter / specific overtime
:shot_clock_range: Filter statistics by range in shot clock
:last_n_games: Filter by number of games specified in N
Attributes:
:json: Contains the full json dump to play around with
"""
_endpoint = 'playerdashptreb'
def shot_type_rebounding(self):
return _api_scrape(self.json, 1)
def num_contested_rebounding(self):
return _api_scrape(self.json, 2)
def shot_distance_rebounding(self):
return _api_scrape(self.json, 3)
def rebound_distance_rebounding(self):
return _api_scrape(self.json, 4)
class PlayerPassTracking(_PlayerDashboard):
"""
Tracking data for passing for a given player
Args:
:player_id: ID of the player to look up
:team_id: ID of the team to look up
:measure_type: Specifies type of measure to use (Base, Advanced, etc.)
:per_mode: Mode to measure statistics (Totals, PerGame, Per36, etc.)
:plus_minus: Whether or not to consider plus minus (Y or N)
:pace_adjust: Whether or not to pace adjust stats (Y or N)
:rank: Whether or not to consider rank (Y or N)
:league_id: ID for the league to look in (Default is 00)
:season: Season given to look up
:season_type: Season type to consider (Regular / Playoffs)
:po_round: Playoff round
:outcome: Filter out by wins or losses
:location: Filter out by home or away
:month: Specify month to filter by
:season_segment: Filter by pre/post all star break
:date_from: Filter out games before a specific date
:date_to: Filter out games after a specific date
:opponent_team_id: Opponent team ID to look up
:vs_conference: Filter by conference
:vs_division: Filter by division
:game_segment: Filter by half / overtime
:period: Filter by quarter / specific overtime
:shot_clock_range: Filter statistics by range in shot clock
:last_n_games: Filter by number of games specified in N
Attributes:
:json: Contains the full json dump to play around with
"""
_endpoint = 'playerdashptpass'
def passes_made(self):
return _api_scrape(self.json, 0)
def passes_received(self):
return _api_scrape(self.json, 1)
class PlayerDefenseTracking(_PlayerDashboard):
"""
Tracking data for defense for a given player
Args:
:player_id: ID of the player to look up
:team_id: ID of the team to look up
:measure_type: Specifies type of measure to use (Base, Advanced, etc.)
:per_mode: Mode to measure statistics (Totals, PerGame, Per36, etc.)
:plus_minus: Whether or not to consider plus minus (Y or N)
:pace_adjust: Whether or not to pace adjust stats (Y or N)
:rank: Whether or not to consider rank (Y or N)
:league_id: ID for the league to look in (Default is 00)
:season: Season given to look up
:season_type: Season type to consider (Regular / Playoffs)
:po_round: Playoff round
:outcome: Filter out by wins or losses
:location: Filter out by home or away
:month: Specify month to filter by
:season_segment: Filter by pre/post all star break
:date_from: Filter out games before a specific date
:date_to: Filter out games after a specific date
:opponent_team_id: Opponent team ID to look up
:vs_conference: Filter by conference
:vs_division: Filter by division
:game_segment: Filter by half / overtime
:period: Filter by quarter / specific overtime
:shot_clock_range: Filter statistics by range in shot clock
:last_n_games: Filter by number of games specified in N
Attributes:
:json: Contains the full json dump to play around with
"""
_endpoint = 'playerdashptshotdefend'
class PlayerShotLogTracking(_PlayerDashboard):
"""
Contains a log for every shot for a given season for a given player
Args:
:player_id: ID of the player to look up
:team_id: ID of the team to look up
:measure_type: Specifies type of measure to use (Base, Advanced, etc.)
:per_mode: Mode to measure statistics (Totals, PerGame, Per36, etc.)
:plus_minus: Whether or not to consider plus minus (Y or N)
:pace_adjust: Whether or not to pace adjust stats (Y or N)
:rank: Whether or not to consider rank (Y or N)
:league_id: ID for the league to look in (Default is 00)
:season: Season given to look up
:season_type: Season type to consider (Regular / Playoffs)
:po_round: Playoff round
:outcome: Filter out by wins or losses
:location: Filter out by home or away
:month: Specify month to filter by
:season_segment: Filter by pre/post all star break
:date_from: Filter out games before a specific date
:date_to: Filter out games after a specific date
:opponent_team_id: Opponent team ID to look up
:vs_conference: Filter by conference
:vs_division: Filter by division
:game_segment: Filter by half / overtime
:period: Filter by quarter / specific overtime
:shot_clock_range: Filter statistics by range in shot clock
:last_n_games: Filter by number of games specified in N
Attributes:
:json: Contains the full json dump to play around with
"""
_endpoint = 'playerdashptshotlog'
class PlayerReboundLogTracking(_PlayerDashboard):
"""
Contains a log for every rebound for a given season for a given player
Args:
:player_id: ID of the player to look up
:team_id: ID of the team to look up
:measure_type: Specifies type of measure to use (Base, Advanced, etc.)
:per_mode: Mode to measure statistics (Totals, PerGame, Per36, etc.)
:plus_minus: Whether or not to consider plus minus (Y or N)
:pace_adjust: Whether or not to pace adjust stats (Y or N)
:rank: Whether or not to consider rank (Y or N)
:league_id: ID for the league to look in (Default is 00)
:season: Season given to look up
:season_type: Season type to consider (Regular / Playoffs)
:po_round: Playoff round
:outcome: Filter out by wins or losses
:location: Filter out by home or away
:month: Specify month to filter by
:season_segment: Filter by pre/post all star break
:date_from: Filter out games before a specific date
:date_to: Filter out games after a specific date
:opponent_team_id: Opponent team ID to look up
:vs_conference: Filter by conference
:vs_division: Filter by division
:game_segment: Filter by half / overtime
:period: Filter by quarter / specific overtime
:shot_clock_range: Filter statistics by range in shot clock
:last_n_games: Filter by number of games specified in N
Attributes:
:json: Contains the full json dump to play around with
"""
_endpoint = 'playerdashptreboundlogs'
class PlayerVsPlayer:
"""
Contains general stats that pertain to players going against other players
Args:
:player_id: ID of the player to look up
:vs_player_id: ID of the vs player to look up
:team_id: ID of the team to look up
:measure_type: Specifies type of measure to use (Base, Advanced, etc.)
:per_mode: Mode to measure statistics (Totals, PerGame, Per36, etc.)
:plus_minus: Whether or not to consider plus minus (Y or N)
:pace_adjust: Whether or not to pace adjust stats (Y or N)
:rank: Whether or not to consider rank (Y or N)
:league_id: ID for the league to look in (Default is 00)
:season: Season given to look up
:season_type: Season type to consider (Regular / Playoffs)
:po_round: Playoff round
:outcome: Filter out by wins or losses
:location: Filter out by home or away
:month: Specify month to filter by
:season_segment: Filter by pre/post all star break
:date_from: Filter out games before a specific date
:date_to: Filter out games after a specific date
:opponent_team_id: Opponent team ID to look up
:vs_conference: Filter by conference
:vs_division: Filter by division
:game_segment: Filter by half / overtime
:period: Filter by quarter / specific overtime
:shot_clock_range: Filter statistics by range in shot clock
:last_n_games: Filter by number of games specified in N
Attributes:
json: Contains the full json dump to play around with
"""
_endpoint = 'playervsplayer'
def __init__(self,
player_id,
vs_player_id,
team_id=0,
measure_type=constants.MeasureType.Default,
per_mode=constants.PerMode.Default,
plus_minus=constants.PlusMinus.Default,
pace_adjust=constants.PaceAdjust.Default,
rank=constants.PaceAdjust.Default,
league_id=constants.League.Default,
season=constants.CURRENT_SEASON,
season_type=constants.SeasonType.Default,
po_round=constants.PlayoffRound.Default,
outcome=constants.Outcome.Default,
location=constants.Location.Default,
month=constants.Month.Default,
season_segment=constants.SeasonSegment.Default,
date_from=constants.DateFrom.Default,
date_to=constants.DateTo.Default,
opponent_team_id=constants.OpponentTeamID.Default,
vs_conference=constants.VsConference.Default,
vs_division=constants.VsDivision.Default,
game_segment=constants.GameSegment.Default,
period=constants.Period.Default,
shot_clock_range=constants.ShotClockRange.Default,
last_n_games=constants.LastNGames.Default):
self.json = _get_json(endpoint=self._endpoint,
params={'PlayerID': player_id,
'VsPlayerID': vs_player_id,
'TeamID': team_id,
'MeasureType': measure_type,
'PerMode': per_mode,
'PlusMinus': plus_minus,
'PaceAdjust': pace_adjust,
'Rank': rank,
'LeagueID': league_id,
'Season': season,
'SeasonType': season_type,
'PORound': po_round,
'Outcome': outcome,
'Location': location,
'Month': month,
'SeasonSegment': season_segment,
'DateFrom': date_from,
'DateTo': date_to,
'OpponentTeamID': opponent_team_id,
'VsConference': vs_conference,
'VsDivision': vs_division,
'GameSegment': game_segment,
'Period': period,
'ShotClockRange': shot_clock_range,
'LastNGames': last_n_games})
def overall(self):
return _api_scrape(self.json, 0)
def on_off_court(self):
return _api_scrape(self.json, 1)
def shot_distance_overall(self):
return _api_scrape(self.json, 2)
def shot_distance_on_court(self):
return _api_scrape(self.json, 3)
def shot_distance_off_court(self):
return _api_scrape(self.json, 4)
def shot_area_overall(self):
return _api_scrape(self.json, 5)
def shot_area_on_court(self):
return _api_scrape(self.json, 6)
def shot_area_off_court(self):
return _api_scrape(self.json, 7)
def player_info(self):
return _api_scrape(self.json, 8)
def vs_player_info(self):
return (_api_scrape(self.json, 9))
from nba_py import _api_scrape, _get_json
from nba_py import constants
class TeamList:
_endpoint = 'commonteamyears'
def __init__(self,
league_id=constants.League.NBA):
self.json = _get_json(endpoint=self._endpoint,
params={'LeagueID': league_id})
def info(self):
return _api_scrape(self.json, 0)
class TeamSummary:
_endpoint = 'teaminfocommon'
def __init__(self,
team_id,
season=constants.CURRENT_SEASON,
league_id=constants.League.NBA,
season_type=constants.SeasonType.Default):
self.json = _get_json(endpoint=self._endpoint,
params={'TeamID': team_id,
'Season': season,
'LeagueID': league_id,
'SeasonType': season_type})
------ omitted data
def closest_defender_shooting(self):
return _api_scrape(self.json, 3)
def closest_defender_shooting_long(self):
return _api_scrape(self.json, 4)
def touch_time_shooting(self):
return _api_scrape(self.json, 5)
class TeamReboundTracking(_TeamDashboard):
_endpoint = 'teamdashptreb'
def shot_type_rebounding(self):
return _api_scrape(self.json, 1)
def contested_rebounding(self):
return _api_scrape(self.json, 2)
def shot_distance_rebounding(self):
return _api_scrape(self.json, 3)
def rebound_distance_rebounding(self):
return _api_scrape(self.json, 4)
class TeamPassTracking(_TeamDashboard):
_endpoint = 'teamdashptpass'
def passes_made(self):
return _api_scrape(self.json, 0)
def passes_recieved(self):
return _api_scrape(self.json, 1)
class TeamVsPlayer:
_endpoint = 'teamvsplayer'
def __init__(self,
team_id,
vs_player_id,
measure_type=constants.MeasureType.Default,
per_mode=constants.PerMode.Default,
plus_minus=constants.PlusMinus.Default,
pace_adjust=constants.PaceAdjust.Default,
rank=constants.Rank.Default,
league_id=constants.League.Default,
season=constants.CURRENT_SEASON,
season_type=constants.SeasonType.Default,
po_round=constants.PlayoffRound.Default,
outcome=constants.Outcome.Default,
location=constants.Location.Default,
month=constants.Month.Default,
season_segment=constants.SeasonSegment.Default,
date_from=constants.DateFrom.Default,
date_to=constants.DateTo.Default,
opponent_team_id=constants.OpponentTeamID.Default,
vs_conference=constants.VsConference.Default,
vs_division=constants.VsDivision.Default,
game_segment=constants.GameSegment.Default,
period=constants.Period.Default,
shot_clock_range=constants.ShotClockRange.Default,
last_n_games=constants.LastNGames.Default):
self.json = _get_json(endpoint=self._endpoint,
params={'TeamID': team_id,
'VsPlayerID': vs_player_id,
'MeasureType': measure_type,
'PerMode': per_mode,
'PlusMinus': plus_minus,
'PaceAdjust': pace_adjust,
'Rank': rank,
'LeagueID': league_id,
'Season': season,
'SeasonType': season_type,
'PORound': po_round,
'Outcome': outcome,
'Location': location,
'Month': month,
'SeasonSegment': season_segment,
'DateFrom': date_from,
'DateTo': date_to,
'OpponentTeamID': opponent_team_id,
'VsConference': vs_conference,
'VsDivision': vs_division,
'GameSegment': game_segment,
'Period': period,
'ShotClockRange': shot_clock_range,
'LastNGames': last_n_games})
def overall(self):
return _api_scrape(self.json, 0)
def vs_player_overall(self):
return _api_scrape(self.json, 1)
def on_off_court(self):
return _api_scrape(self.json, 2)
def shot_distance_overall(self):
return _api_scrape(self.json, 3)
def shot_distance_on_court(self):
return _api_scrape(self.json, 4)
def shot_distance_off_court(self):
return _api_scrape(self.json, 5)
def shot_area_overall(self):
return _api_scrape(self.json, 6)
def shot_area_on_court(self):
return _api_scrape(self.json, 7)
def shot_area_off_court(self):
return _api_scrape(self.json, 8)
####################################
## Now the action;
####################################
fields = 'Player name:', 'Player surname:'
def get_values(entries):
first_name = entries[0]
first_name = first_name[1].get()
### For every field we extract the data and then make it a float object.
last_name = entries[1]
last_name = last_name[1].get()
### These complications for volumes come because I want to enable user to not enter anything in that field
### With this we'll make sure it still works.
return (first_name,last_name)
def makeform(root, fields):
entries = []
for field in fields:
row = Frame(root)
lab = Label(row, width=15, text=field, anchor='w')
ent = Entry(row)
ent.insert(0,"")
row.pack(side=TOP, fill=X, padx=5, pady=5)
lab.pack(side=LEFT)
ent.pack(side=RIGHT, expand=YES, fill=X)
entries.append((field, ent))
return entries
------ omitted data
opp_name = "{} {}".format(TeamSummary(opp_team_id).info().TEAM_CITY[0],TeamSummary(opp_team_id).info().TEAM_NAME[0])
myindex = np.where(TeamOpponentSplits(team_id).by_opponent().GROUP_VALUE==opp_name)[0]
my_df = TeamOpponentSplits(team_id).by_opponent()
mydf5 = mydf3
mydf5.PTS[0] = my_df.PTS[myindex]
mydf5.FGM[0] = my_df.FGM[myindex]
mydf5.FGA[0] = my_df.FGA[myindex]
mydf5.FG3M[0] = my_df.FG3M[myindex]
mydf5.FG3A[0] = my_df.FG3A[myindex]
mydf5.FTM[0] = my_df.FTM[myindex]
mydf5.FTA[0] = my_df.FTA[myindex]
mydf5.OREB[0] = my_df.OREB[myindex]
mydf5.DREB[0] = my_df.DREB[myindex]
mydf5.REB[0] = my_df.REB[myindex]
mydf5.AST[0] = my_df.AST[myindex]
mydf5.STL[0] = my_df.STL[myindex]
mydf5.BLK[0] = my_df.BLK[myindex]
mydf5.TOV[0] = my_df.TOV[myindex]
my_df = TeamLastNGamesSplits(team_id).last10()
mydf6 = mydf3
mydf6.PTS[0] = my_df.PTS[0]
mydf6.FGM[0] = my_df.FGM[0]
mydf6.FGA[0] = my_df.FGA[0]
mydf6.FG3M[0] = my_df.FG3M[0]
mydf6.FG3A[0] = my_df.FG3A[0]
mydf6.FTM[0] = my_df.FTM[0]
mydf6.FTA[0] = my_df.FTA[0]
mydf5.OREB[0] = my_df.OREB[0]
mydf6.DREB[0] = my_df.DREB[0]
mydf6.REB[0] = my_df.REB[0]
mydf6.AST[0] = my_df.AST[0]
mydf6.STL[0] = my_df.STL[0]
mydf6.BLK[0] = my_df.BLK[0]
mydf6.TOV[0] = my_df.TOV[0]
mydf7 = mydf5 *0.7 + mydf6 * 0.3
quote = "\n --------------------------------- \n And expected points: \n{}".format(mydf7)
T.insert(END, quote)
def del_text():
T.delete('1.0', END)
root = Tk()
root.wm_title("Fantasy basketball tool")
scrollbar = Scrollbar(root)
scrollbar.pack(side=RIGHT, fill=Y)
ents = makeform(root, fields)
var = StringVar()
label = Label( root, textvariable=var, relief=RAISED )
var.set("Choose the home team (optional if you already chose the player.)")
label.pack()
listbox = Listbox(root,yscrollcommand=TRUE,exportselection=0)
listbox.pack()
myteams = TeamList().info()
myteams = myteams[myteams.MAX_YEAR=="2017"]
for item in range(len(myteams.ABBREVIATION)):
listbox.insert(END, myteams.ABBREVIATION[item])
### Listbox 2;
var1 = StringVar()
label1 = Label( root, textvariable=var1, relief=RAISED )
var1.set("Choose the opposite team.")
label1.pack()
listbox2 = Listbox(root,yscrollcommand=TRUE,exportselection=0)
listbox2.pack()
for item in range(len(myteams.ABBREVIATION)):
listbox2.insert(END, myteams.ABBREVIATION[item])
b1 = Button(root, text='Analyze!',command=(lambda e=ents: fetch(e,myteams)))
b1.pack(side=LEFT, padx=5, pady=5)
b7 = Button(root, text='Clear output', command=del_text)
b7.pack(side=LEFT, padx=5, pady=5)
T = Text(root, height=100, width=130, yscrollcommand=scrollbar.set)
T.pack()
root.mainloop()