Tutorial: TournamentsΒΆ

Simulating tournaments like the World Cup require some more preparations. In the following, we will show how to simulate the 2021 European Championship. First, we import the necessary packages.

from fussballgott import load, plot, tournament

Then, we have to prepare the data. This requires the following steps:

  1. Setup up the tournament mode in a csv file of the following format:

  1. Setup all the teams in a csv file of the following format:

If the tournament does not have groups, the column group can be omitted.

  1. Setup the knockout round with a file for each round. The file format for the first knockout round is as follows:

If the tournament does not have a group stage, instead of 1A, 2B, etc., you should directly put the names of the teams. The file format for the second knockout round is as follows:

and so on. Note that the title of the csv file contains the number of the round. So for the quarterfinals, the file name should be tournament_4.csv, for the semifinals tournament_2.csv, etc.

  1. In the special case of the European Championship, there were also some of the third placed teams that advanced to the knockout round. The way that these teams are assigned to the knockout round is also specified in a csv file:

Now, after preparation, we can load the data and simulate the tournament.

mode, ko_round, teams, groups = load.tournament("demo_tournament_")
sim = tournament.simulate(mode, ko_round, teams, groups, n_sim=1e4)
plot.tournament(sim)
../_images/output_3_0.png