{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Working with CEBL data in Python Using `ceblpy`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Overview\n", "\n", "This guide explains how to use the `ceblpy` package to access clean and tidy data from the Canadian Elite Basketball League (CEBL)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Installation\n", "\n", "You can install the **[ceblpy](https://github.com/ryanndu/ceblpy)** package with:\n", "\n", "```bash\n", "$ pip install ceblpy\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Usage\n", "\n", "The following code shows how to get stats from the Canadian Elite Basketball League (CEBL)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To use `ceblpy` in a project:" ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.1.0\n" ] } ], "source": [ "import ceblpy\n", "print(ceblpy.__version__)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### `load_cebl_schedule()`" ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " fiba_id season ... id \\\n", "358 2400360 2024 ... 933 \n", "359 2400354 2024 ... 927 \n", "360 2400353 2024 ... 926 \n", "361 2400355 2024 ... 928 \n", "362 2400356 2024 ... 929 \n", "\n", " fiba_json_url \n", "358 https://fibalivestats.dcd.shared.geniussports.... \n", "359 https://fibalivestats.dcd.shared.geniussports.... \n", "360 https://fibalivestats.dcd.shared.geniussports.... \n", "361 https://fibalivestats.dcd.shared.geniussports.... \n", "362 https://fibalivestats.dcd.shared.geniussports.... \n", "\n", "[5 rows x 27 columns]\n" ] } ], "source": [ "from ceblpy.ceblpy import load_cebl_schedule\n", "\n", "# Get the schedule for 2024\n", "schedule = load_cebl_schedule(2024)\n", "print(schedule.head())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### `load_cebl_team_boxscore()`" ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " game_id season ... logo_s_width logo_s_bytes\n", "716 2400360 2024 ... 200 16051\n", "717 2400360 2024 ... 200 18967\n", "718 2400354 2024 ... 200 32787\n", "719 2400354 2024 ... 200 24797\n", "720 2400353 2024 ... 200 22272\n", "\n", "[5 rows x 75 columns]\n" ] } ], "source": [ "from ceblpy.ceblpy import load_cebl_team_boxscore\n", "\n", "# Get the team boxscores for 2024\n", "team_boxscore = load_cebl_team_boxscore(2024)\n", "print(team_boxscore.head())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### `load_cebl_player_boxscore()`" ] }, { "cell_type": "code", "execution_count": 43, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " game_id season ... photo_t \\\n", "7251 2400360 2024 ... https://se-img.dcd-production.i.geniussports.c... \n", "7252 2400360 2024 ... NaN \n", "7253 2400360 2024 ... NaN \n", "7254 2400360 2024 ... NaN \n", "7255 2400360 2024 ... NaN \n", "\n", " photo_s \n", "7251 https://se-img.dcd-production.i.geniussports.c... \n", "7252 NaN \n", "7253 NaN \n", "7254 NaN \n", "7255 NaN \n", "\n", "[5 rows x 55 columns]\n" ] } ], "source": [ "from ceblpy.ceblpy import load_cebl_player_boxscore\n", "\n", "# Get the player boxscores for 2024\n", "player_boxscore = load_cebl_player_boxscore(2024)\n", "print(player_boxscore.head())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### `load_cebl_officials()`" ] }, { "cell_type": "code", "execution_count": 42, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " game_id season ... international_last_name \\\n", "941 2400360 2024 ... Kerrison \n", "942 2400360 2024 ... Stothart \n", "943 2400360 2024 ... Toppings \n", "944 2400354 2024 ... Turnbull \n", "945 2400354 2024 ... Donnelly \n", "\n", " international_last_name_initial \n", "941 K \n", "942 S \n", "943 T \n", "944 T \n", "945 D \n", "\n", "[5 rows x 13 columns]\n" ] } ], "source": [ "from ceblpy.ceblpy import load_cebl_officials\n", "\n", "# Get the officials for 2024\n", "officials = load_cebl_officials(2024)\n", "print(officials.head())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### `load_cebl_coaches()`" ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " game_id season ... international_last_name_initial scoreboard_name\n", "1711 2400360 2024 ... V T. Vernon\n", "1712 2400360 2024 ... R W. Rooney\n", "1713 2400360 2024 ... B J. Baker\n", "1714 2400360 2024 ... H G. Hoyt\n", "1715 2400354 2024 ... A L. Abney\n", "\n", "[5 rows x 14 columns]\n" ] } ], "source": [ "from ceblpy.ceblpy import load_cebl_coaches\n", "\n", "# Get the coaches for 2024\n", "coaches = load_cebl_coaches(2024)\n", "print(coaches.head())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### `load_cebl_pbp()`" ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " game_id season ... international_first_name_initial \\\n", "0 2400360 2024 ... NaN \n", "1 2400360 2024 ... NaN \n", "2 2400360 2024 ... A \n", "3 2400360 2024 ... D \n", "4 2400360 2024 ... D \n", "\n", " international_last_name_initial \n", "0 NaN \n", "1 NaN \n", "2 P \n", "3 R \n", "4 R \n", "\n", "[5 rows x 33 columns]\n" ] } ], "source": [ "from ceblpy.ceblpy import load_cebl_pbp\n", "\n", "# Get the pbp for 2024\n", "pbp = load_cebl_pbp(2024)\n", "print(pbp.head())" ] } ], "metadata": { "kernelspec": { "display_name": "ceblpy-5JUJ5wWT-py3.13", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.1" } }, "nbformat": 4, "nbformat_minor": 4 }