Exemple #1
0
#!/usr/local/bin/python3

from five_thirty_eight.utilities import FiveThirtyEightDataset, load_dataset

REPO_PATH = 'liquidata-demo-data/polls'
BASE_PRIMARY_KEYS = ['question_id', 'poll_id', 'pollster_id', 'sponsor_ids']
POLLS = {
    'president_primary_polls': BASE_PRIMARY_KEYS + ['candidate_id'],
    'president_polls': BASE_PRIMARY_KEYS + ['candidate_name'],
    'senate_polls': BASE_PRIMARY_KEYS + ['candidate_name'],
    'house_polls': BASE_PRIMARY_KEYS + ['candidate_name'],
    'governor_polls': BASE_PRIMARY_KEYS + ['candidate_name'],
    'president_approval_polls': BASE_PRIMARY_KEYS,
    'generic_ballot_polls': BASE_PRIMARY_KEYS
}
SUBPATH = 'polls-page'
DATASETS = [
    FiveThirtyEightDataset(SUBPATH, name, pks) for name, pks in POLLS.items()
]

if __name__ == 'main':
    load_dataset(REPO_PATH, DATASETS, '')
Exemple #2
0
#!/usr/local/bin/python3

from five_thirty_eight.utilities import FiveThirtyEightDataset, load_dataset

REPO_PATH = 'liquidata-demo-data/soccer-spi'
SUBPATH = 'soccer-api'
DATASETS = {
    'spi_global_rankings_intl': ('international', ['name', 'confed']),
    'spi_global_rankings': ('club', ['name', 'league']),
    'spi_matches': ('club', ['date', 'league_id', 'team1', 'team2'])
}
ELO_DATASETS = [
    FiveThirtyEightDataset('{}/{}'.format(SUBPATH, infix), name, primary_keys)
    for name, (infix, primary_keys) in DATASETS.items()
]

if __name__ == 'main':
    load_dataset(REPO_PATH, ELO_DATASETS, '')
#!/usr/local/bin/python3

from five_thirty_eight.utilities import FiveThirtyEightDataset, load_dataset

SUBPATH = 'nba-model'
PRIMARY_KEYS = ['date', 'season', 'team1', 'team2']
ELO_DATASETS = [FiveThirtyEightDataset(SUBPATH, 'nba_elo', PRIMARY_KEYS)]
REPO_PATH = 'liquidata-demo-data/nba-forecasts'

if __name__ == 'main':
    load_dataset(REPO_PATH, ELO_DATASETS, '')