Package: underdata
underdataPython package for get data ofwww.understat.com. There are available 6 european leagues:Premier League,La Liga,Bundesliga,Serie A,Ligue 1andRussian Premier Leaguefrom season 2014/2015.NoteThis package is in development yet, then can change.InstallationTo install the package:gitclonegit@github.com:osvaldomx/UnderData.git
cp~/understat/<your_project>This package useseleniumtherefore you will have to installgeckodriver.Getting startedObjecturlunderdata.League()https://www.understat.com/league/<league_name>/<year>underdata.Team()https://www.understat.com/team/<team_name>/<year>underdata.Player()https://www.understat.com/player/<player_id>underdata.Match()https://www.understat.com/player/<match_id>ExamplesLeagueTo get general information of a league:# import>>>fromunderdata.LeagueimportLeague>>>league=League(league="epl",year="2018")>>>league.get_info()'Get info of EPL'this will open a browser withgeckodriverwith the purpose of get general information of the leagueEPLin the year2018. To access to the information, run:>>>league.seasons# Get seasons availables in www.understats.com['2021','2020','2019','2018','2017','2016','2015','2014']>>>league.table# Get the current qualification table or correspondant to the specific yearNTeamMWDLGGAPTSxGxGAxPTS01ManchesterCity38322495239893.72-1.2825.73+2.7390.64-7.3612Liverpool38307189229779.46-9.5429.15+7.1583.45-13.55...>>>league.table_goals# Get top-10 of scorersNPlayerTeamAppsMinGAxGxAxG90xA9001Pierre-EmerickAubameyangArsenal36274022523.55+1.554.99-0.010.770.1612SadioManéLiverpool36310022116.76-5.245.12+4.120.490.15...TeamTo get general information of a league:# import>>>fromunderdata.TeamimportTeam>>>team=Team(team="liverpool",year="2018")>>>Team.get_info()'Get info of Liverpool'this will open a browser withgeckodriverwith the purpose of get general information of the teamLiverpoolin the year2018. To access to the information, run:>>>team.games# Get info of games of team in specific yearweekdatehomeawaygoals_homegoals_awayxG_homexG_awayresulturl01Aug12,2018liverpoolWestHam404.340.40winhttps://understat.com/match/920512Aug20,2018CrystalPalaceliverpool020.372.82winhttps://understat.com/match/9216...>>>team.player_stats# Get info of all team players in specific yearIdPlayerPosAppsMinGASh90KP90xGxAxG90xA900838SadioManéFM3631002212.531.3116.76-5.245.12+4.120.490.1511250MohamedSalahF3832742283.771.8721.79-0.2110.47+2.470.600.29...PlayerTo get general information of a player:# import>>>fromunderdata.PlayerimportPlayer>>>player=Player(player_id="1250")>>>player.get_info()'Get info of Mohamed Salah'this will open a browser withgeckodriverwith the purpose of get general information of the player with id1250. To access to the information, run:>>>player.table_seasons# Get info of seasons of the playerSeasonTeamAppsMinGASh90KP90xGxAxG90xA9002021/2022Liverpool98101054.442.337.50-2.503.14-1.860.830.3512020/2021Liverpool3730852253.681.6020.25-1.756.53+1.530.590.19...>>>player.player_history# Get info of all appears of the playerDateHomeScoreAwayPosMinShGKPAxGxA02021-10-24ManchesterUnited0-5LiverpoolFWR9073212.25-0.750.51-0.4912021-10-16Watford0-5LiverpoolFWR9051210.40-0.600.36-0.64...MatchTo get general information of a Match:# import>>>fromunderdata.MatchimportMatch>>>match=Match(match_id="16463")>>>match.get_info()'Get info of Manchester United vs Liverpool'this will open a browser withgeckodriverwith the purpose of get general information of the match with id16463. To access to the information, run:>>>match.match_stats# Get stats of the matchPlayerPosMinShGKPAxGxA0DaviddeGeaGK9000000.000.001AaronWan-BissakaDR9000000.000.002VictorLindelöfDC9000000.000.00...25SadioManéSub810000.11+0.110.0026AlexOxlade-ChamberlainSub2110100.02+0.020.04+0.0427CurtisJonesSub6410100.15+0.150.03+0.03Contributing