GithubHelp home page GithubHelp logo

Comments (1)

probberechts avatar probberechts commented on June 1, 2024
  1. You have to store the WhoScored JSON files in a file structure that includes the competition ID, season ID and game ID. For example: ./data/2-2021/game_1234.json, ./data/2-2021/game_1235.json, ... where 2 is the competition ID, 2021 is the season ID, and 1234 and 1235 are the game IDs.

  2. Create and OptaLoader instance

from socceraction.spadl.opta import OptaLoader

loader = OptaLoader(
    root="./data", 
    parser='whoscored',
    feeds={'whoscored': "{competition_id}-{season_id}/game_{game_id}.json"})

The feeds dict is a pattern that allows the loader to select the corresponding json files for a competition, season or game. It should correspond to the file structure above, where the IDs are replaced by the "{competition_id}", "{season-id}" and "{game_id}" keys.

  1. Load data with
games = games(competition_id=2, season_id=2021)
players = loader.players(game_id=1234)
teams = loader.teams(game_id=1234)
events = loader.events(game_id=1234)

Some notes:

  • The WhoScored JSON files do not contain data about the competitions, so you won't get any data from loader.competitions().
  • The competition_id, season_id and game_id have to be integers. This changed in v1.0.1

from socceraction.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.