Skip to content

Commit

Permalink
2425 season setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jack89roberts committed Jul 23, 2024
1 parent 9a2a9dd commit 6ca8347
Show file tree
Hide file tree
Showing 6 changed files with 676 additions and 547 deletions.
1,125 changes: 597 additions & 528 deletions airsenal/data/absences_2324.csv

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions airsenal/data/fifa_team_ratings_2425.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
team_name,att,mid,defn,ovr
Manchester City,87,87,84,85
Liverpool,84,81,84,83
Arsenal,83,84,81,82
Manchester United,82,84,82,82
Tottenham Hotspur,83,82,79,81
Newcastle United,80,81,82,81
Chelsea,78,81,79,81
Aston Villa,79,80,80,80
West Ham United,77,77,77,78
Everton,79,76,75,77
Wolverhampton Wanderers,78,77,75,77
Fulham,77,77,76,77
Brighton & Hove Albion,76,78,78,77
Brentford,75,76,76,77
Nottingham Forest,76,76,75,76
Crystal Palace,75,76,76,76
Leicester City,73,76,75,76
Bournemouth,74,74,74,74
Burnley,73,74,74,74
Southampton,73,74,74,74
Leeds United,73,72,72,74
Luton Town,72,71,72,72
Norwich City,71,72,71,72
Sheffield United,69,73,72,72
Watford,70,71,69,71
West Bromwich Albion,69,72,70,71
Middlesbrough,67,71,71,71
Stoke City,70,70,69,70
Hull City,68,71,70,70
Swansea City,71,70,67,69
Cardiff City,70,70,68,69
Queens Park Rangers,67,69,69,69
Sunderland,57,67,69,69
Ipswich,67,69,68,68
Huddersfield Town,67,67,68,68
Derby County,66,67,67,67
21 changes: 21 additions & 0 deletions airsenal/data/teams_2425.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name,full_name,season,team_id
ARS,Arsenal,2425,1
AVL,Aston Villa,2425,2
BOU,Bournemouth,2425,3
BRE,Brentford,2425,4
BHA,Brighton,2425,5
CHE,Chelsea,2425,6
CRY,Crystal Palace,2425,7
EVE,Everton,2425,8
FUL,Fulham,2425,9
IPS,Ipswich,2425,10
LEI,Leicester,2425,11
LIV,Liverpool,2425,12
MCI,Man City,2425,13
MUN,Man Utd,2425,14
NEW,Newcastle,2425,15
NFO,Nott'm Forest,2425,16
SOU,Southampton,2425,17
TOT,Spurs,2425,18
WHU,West Ham,2425,19
WOL,Wolves,2425,20
21 changes: 11 additions & 10 deletions airsenal/framework/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"Brighton & Hove Albion FC",
"Brighton & Hove Albion",
],
"BUR": ["6", "Burnley", "Burnley FC"],
"CHE": ["7", "Chelsea", "Chelsea FC"],
"CRY": ["8", "Crystal Palace", "Crystal Palace FC"],
"EVE": ["9", "Everton", "Everton FC"],
"FUL": ["10", "Fulham", "Fulham FC"],
"LIV": ["11", "Liverpool", "Liverpool FC"],
"LUT": ["12", "Luton", "Luton Town"],
"CHE": ["6", "Chelsea", "Chelsea FC"],
"CRY": ["7", "Crystal Palace", "Crystal Palace FC"],
"EVE": ["8", "Everton", "Everton FC"],
"FUL": ["9", "Fulham", "Fulham FC"],
"IPS": ["10", "Ipswich", "Ipswich Town"],
"LEI": ["11", "Leicester City", "Leicester", "Leicester City FC"],
"LIV": ["12", "Liverpool", "Liverpool FC"],
"MCI": ["13", "Manchester City", "Man City", "Manchester City FC"],
"MUN": [
"14",
Expand All @@ -39,13 +39,14 @@
"Newcastle Utd",
],
"NFO": ["16", "Nott'm Forest", "Nottingham Forest"],
"SHU": ["17", "Sheffield United", "Sheffield Utd"],
"SOU": ["17", "Southampton", "Southampton FC"],
"TOT": ["18", "Tottenham Hotspur", "Spurs", "Tottenham Hotspur FC"],
"WHU": ["19", "West Ham United", "West Ham", "West Ham United FC"],
"WOL": ["20", "Wolves", "Wolverhampton Wanderers", "Wolverhampton Wanderers FC"],
"LEI": ["Leicester City", "Leicester", "Leicester City FC"],
"BUR": ["Burnley", "Burnley FC"],
"LEE": ["Leeds", "Leeds United", "Leeds Utd"],
"SOU": ["Southampton", "Southampton FC"],
"LUT": ["Luton", "Luton Town"],
"SHU": ["Sheffield United", "Sheffield Utd"],
"NOR": ["Norwich City", "Norwich"],
"WAT": ["Watford", "Watford FC"],
"WBA": ["West Bromwich Albion", "West Brom"],
Expand Down
17 changes: 9 additions & 8 deletions airsenal/scripts/scrape_transfermarkt.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,14 @@ def get_team_players(team_season_url: str) -> List[Tuple[str, str]]:
team_soup = BeautifulSoup(page.content, features="lxml")
player_rows = team_soup.find_all("td", {"class": "posrela"})

return [
(r.find_all("a")[-1].get("title"), r.find_all("a")[-1].get("href"))
for r in player_rows
]
player_names_urls = []
for r in player_rows:
last_a_tag = r.find_all("a")[-1]
name = last_a_tag.contents[0].strip()
url = last_a_tag.get("href")
player_names_urls.append((name, url))

return player_names_urls


def tidy_df(df: pd.DataFrame, days_name: str = "days") -> pd.DataFrame:
Expand Down Expand Up @@ -680,10 +684,7 @@ def main():
parser.add_argument(
"-v",
"--verbose",
help=(
"Which season(s) to update (comma separated, e.g. 2021,2122 "
"for 2020/21 and 2021/22 seasons)"
),
help="Print more information on progress if set",
action="store_true",
default=False,
)
Expand Down
2 changes: 1 addition & 1 deletion airsenal/tests/test_squad_history_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@


def get_squad_for_gameweek(
subs, captain, vice_captain, gameweek, season=CURRENT_SEASON, fpl_team_id=2779516
subs, captain, vice_captain, gameweek, season=CURRENT_SEASON, fpl_team_id=2004389
):
s = get_squad_from_transactions(gameweek)
for p in s.players:
Expand Down

0 comments on commit 6ca8347

Please sign in to comment.