Simulate a penalty shootout between two teams with given penalty scoring.
penalty_scoring1 – Penalty scoring of team 1 (between 0 and 1)
penalty_scoring2 – Penalty scoring of team 2 (between 0 and 1)
home goals, away goals
Simulate a game between two teams with given average goals for and against.
AvGoalsF1 – Average goals for team 1
AvGoalsF2 – Average goals for team 2
AvGoalsA1 – Average goals against team 1
AvGoalsA2 – Average goals against team 2
include_goals_against – If True, the average goals against are included
extra_time – If True, extra time and penalty shootout are included
penalty_scoring1 – Penalty scoring of team 1 (between 0 and 1)
penalty_scoring2 – Penalty scoring of team 2 (between 0 and 1)
return_when – If True, the result is returned together with the time when the game was decided and the result before overtime
home goals, away goals
when, home goals and away goals after 90 minutes (if return_when=True)
Simulate a game between two teams (with given team classes)
team1 – team class of team 1
team2 – team class of team 2
include_goals_against – If True, the average goals against are included
extra_time – If True, extra time and penalty shootout are included
return_when – If True, the result is returned together with the time when the game was decided and the result before overtime
home goals, away goals
when, home goals and away goals after 90 minutes (if return_when=True)
Simulate the statistics of a game between two teams.
AvGoalsF1 – Average goals for team 1
AvGoalsF2 – Average goals for team 2
AvGoalsA1 – Average goals against team 1
AvGoalsA2 – Average goals against team 2
n_sim – Number of simulations
include_goals_against – If True, the average goals against are included
extra_time – If True, extra time and penalty shootout are included
extra_time_result – if True, result after extra time is included in return
penalty_scoring1 – Penalty scoring of team 1 (between 0 and 1)
penalty_scoring2 – Penalty scoring of team 2 (between 0 and 1)
max_goals – Maximum number of goals for the table
table of results, win probabilities
Simulate the statistics of a game between two teams.
team1 – team class of team 1
team2 – team class of team 2
include_goals_against – If True, the average goals against are included
extra_time – If True, extra time and penalty shootout are included
extra_time_result – if True, result after extra time is included in return
n_sim – Number of simulations
table of result probabilities, win probabilities
Simulate a game between two teams with given average goals for and against in 90 minutes.
AvGoalsF1 – Average goals for team 1
AvGoalsF2 – Average goals for team 2
AvGoalsA1 – Average goals against team 1
AvGoalsA2 – Average goals against team 2
include_goals_against – If True, the average goals against are included
multiplier – Multiplier for the average goals, e.g. 1/3 for overtime
home goals, away goals
Convert numpy table to pandas table.
table – Table of the league
dict_num2team – Dictionary that maps indices to teams
Table of the league as pandas table
Convert pandas schedule and table to numpy arrays.
schedule – Schedule of the league
table – Table of the league
schedule and table as numpy arrays
Simulate a league with given teams and schedule.
teams – Dictionary with teams as keys and team objects as values
schedule – Schedule of the league. If int, all teams play against each other schedule times. If pd.DataFrame, the schedule is given as a table with columns “Home” and “Away”.
table – Table of the league. If None, a new table is created
missing_games – List of games that are not played
n_sim – Number of simulations
include_goals_against – If True, the average goals against are included
sorting – Sorting of the table
progressbar – If True, a progressbar is shown
tournament_mode – If True, the table is returned, if False, the ranking table is returned
table (if tournament_mode) or ranking table (if not tournament_mode)
Simulate a league with given teams and schedule.
schedule – numpy array with schedule
table – numpy array with table
teams – Dictionary with teams as keys and team objects as values
missing_games – List of games that are not played
dict_num2team – Dictionary that maps indices to teams
include_goals_against – If True, the average goals against are included
changed table
Create the table from the schedule and results
sched_n_r – Schedule and results
teams – List of teams
Table, missing games
Get the missing games from the schedule
table – Table
schedule – Schedule
Boolean array with missing games
Get all teams from a DataFrame with a schedule.
df – DataFrame with schedule
columns – Columns of the DataFrame that contain the teams
Array with all teams
Load a league from a file or a list of files. Setups the teams classes, the schedule, the table and the missing games.
Input can be: - One file with the schedule and results of the games played so far - Two files, one with the schedule and one with the table
files – File or list of files
delimiter – Delimiter of the files
teams, schedule, table, missing_games
Sort the table according to the tiebreaker rule
table – Table to be sorted
rule – Tiebreaker rule
Sorted table
Load the tournament plan from file and setup team classes. Assuming your filename is tournament_, you should have the following files in your path:
tournament_mode.CSV to describe the mode of the tournament
tournament_teams.CSV to describe the teams playing
tournament_{n}.CSV with n ranging from 2 to 2**x, where x is the number of rounds played in the tournament. The files contain the schedule of the games played in the knockout round.
tournament_special_rule.CSV if there is a special rule for the tournament (e.g. some of the best third placed teams qualify for the next round)
filename – Name of the file
path – Path to the file
delimiter – Delimiter of the file
teams, schedule, table, missing_games
Plot the game statistics in a heatmap.
sim – DataFrame with the simulation results
winprob – Array with the win probabilities
team1 – Name of the first team
team2 – Name of the second team
Bases: object
Class for a team.
name – Name of the team
GoalsF – Goals scored
GoalsA – Goals conceded
played – Number of games played
penalty_scoring – Factor for penalty scoring
Average goals conceded per game
Average goals scored per game
Simulate a tournament with given teams and schedule.
mode – Dictionary with the mode of the tournament
ko_round – List of pandas DataFrames with the knockout rounds
teams – Dictionary with teams as keys and team objects as values
groups – Dictionary with groups as keys and teams as values
n_sim – Number of simulations
include_goals_against – If True, the average goals against are included
sorting – Sorting of the table
small_final – If True, the tournament ends has a small final
progressbar – If True, a progressbar is shown
simlated tournament table