FiveThirtyEight¶
- class soccerdata.FiveThirtyEight(leagues=None, seasons=None, proxy=None, no_cache=False, no_store=False, data_dir=PosixPath('/home/docs/soccerdata/data/FiveThirtyEight'))¶
Provides pd.DataFrames from FiveThirtyEight’s “Club Soccer Predictions” project.
Data will be downloaded as necessary and cached locally in
~/soccerdata/data/FiveThirtyEight
.Original project and background info: https://projects.fivethirtyeight.com/soccer-predictions/ and https://fivethirtyeight.com/features/how-our-club-soccer-projections-work/
- Parameters:
leagues (string or iterable, optional) – IDs of leagues to include.
seasons (string, int or list, optional) – Seasons to include. Supports multiple formats. Examples: ‘16-17’; 2016; ‘2016-17’; [14, 15, 16]
proxy ('tor' or dict or list(dict) or callable, optional) –
- Use a proxy to hide your IP address. Valid options are:
”tor”: Uses the Tor network. Tor should be running in the background on port 9050.
dict: A dictionary with the proxy to use. The dict should be a mapping of supported protocols to proxy addresses. For example:
{ 'http': 'http://10.10.1.10:3128', 'https': 'http://10.10.1.10:1080', }
list(dict): A list of proxies to choose from. A different proxy will be selected from this list after failed requests, allowing rotating proxies.
callable: A function that returns a valid proxy. This function will be called after failed requests, allowing rotating proxies.
no_cache (bool) – If True, will not use cached data.
no_store (bool) – If True, will not store downloaded data.
data_dir (Path) – Path to directory where data will be cached.
- read_games()¶
Retrieve all games for the selected leagues.
- Return type:
pd.DataFrame
- read_forecasts()¶
Retrieve the forecasted results for the selected leagues.
- Return type:
pd.DataFrame
- read_clinches()¶
Retrieve clinches for the selected leagues.
- Return type:
pd.DataFrame
- classmethod available_leagues()¶
Return a list of league IDs available for this source.
- Return type:
list[str]