Skip to main content

Gandula grabs football data and puts it back into play.

Project description

gandula

gandula

gandula is a specialized internal Python library developed by the Sports Analytics lab at the Federal University of Minas Gerais (UFMG). Designed to streamline our research efforts, gandula currently offers tools to help handling PFF data.

Gandula is the word for ball boy in brazilian portuguese. It originates from the 1930s, from the word "gandulo", that in archaic portuguese means slacker/beggar. Back in the 30s, the word started to be used to refer to vagabond boys, who didn't nothing else to do but watch football in the pitches in Rio. These "gandulas" would help by bringing the kicked out balls. In 1939, the Clube de Regatas Vasco da Gama hired the argentinian stricker Bernardo Gandulla, who was known to bring back the ball as a fair play. The gandula then got popularized over the country. In our gandula, the ball is the data, and the data scientists/analysts are the stars of the game.


Quick Start

Installation

In progress...

Installation (for development)

To get started with gandula, follow these steps:

Clone the repository:

git clone git@github.com:SALabUFMG/gandula.git
cd gandula

Create and setup the environment. You can use python virtual environments or conda:

python3 -m venv .venv
source .venv/bin/activate

or:

conda create --prefix .venv python=3.10
conda activate ./.venv

After activating your environment, install uv Install Poetry

pip install uv

Use uv to install the package:

uv pip install .

You're almost good to go. If you want to contribute, you'll also need to install pre-commit hooks that we use to keep the code clean. Install pre-commit hooks:

pip install pre-commit
pre-commit install

Run the pre-commit before every commit

pre-commit run

Setup

If you have access to the PFF API, you can use our PFF_GQL_Client. Create the file .env and add your PFF_API_KEY there:

PFF_API_KEY='YOUR_PFF_API_KEY'

If you don't have to the PFF API, but have acess to the data as json, you may want to use PFF_JSON_Client.


Usage

We have notebooks that showcase how you can use the package.

  • pff-load-from-json.ipynb: shows how to get event data using the JSON client.
  • pff-data-transformation.ipynb: shows how to get data using the GQL client.
  • pff-defensive-line-height.ipynb: gives example on how to use tracking data to define the defensive line of a team.
  • pff-search.ipynb: gets video to watch a certain event.
  • pff-tracking.ipynb: shows how to plot a video using tracking data.
  • pff-events-withing-tracking-to-pandas.ipynb: passes events within the data into pandas.

Development

For those looking to contribute to gandula, please ensure you have followed the installation steps under Quick Start. For more detailed information on setting up your development environment and contributing, refer to our contributing guidelines.


License & Copyright

The main image is "Ballkid at soccer, China" by Micah Sittig, licensed under CC BY 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gandula-0.3.1.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gandula-0.3.1-py3-none-any.whl (62.6 kB view details)

Uploaded Python 3

File details

Details for the file gandula-0.3.1.tar.gz.

File metadata

  • Download URL: gandula-0.3.1.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.2

File hashes

Hashes for gandula-0.3.1.tar.gz
Algorithm Hash digest
SHA256 d7f11247a17b2e9b36acc64ef8e0121d7dab8d1af44563bbf8c696a0100793b3
MD5 2114c8671bec8a7576491ae2a2f2f5c7
BLAKE2b-256 ac9210df9e47071e5fa862c072175fe490992b7c013d1011f107b005f6e8dd82

See more details on using hashes here.

File details

Details for the file gandula-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: gandula-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 62.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.2

File hashes

Hashes for gandula-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f7f54e2732a7c6cae766006e876378c6aa8e6457fa55eb3ad471c184257be191
MD5 08ce2c376c1e7b7ef991dc11a33a5e48
BLAKE2b-256 c084a3c5cb136b321071c1e2240f70de549af00407ca69393e4c375d6323847a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page