Working with CEBL data in Python Using ceblpy

Overview

This guide explains how to use the ceblpy package to access clean and tidy data from the Canadian Elite Basketball League (CEBL).

Installation

You can install the ceblpy package with:

$ pip install ceblpy

Usage

The following code shows how to get stats from the Canadian Elite Basketball League (CEBL).

To use ceblpy in a project:

import ceblpy
print(ceblpy.__version__)
0.1.0

load_cebl_schedule()

from ceblpy.ceblpy import load_cebl_schedule

# Get the schedule for 2024
schedule = load_cebl_schedule(2024)
print(schedule.head())
     fiba_id  season  ...   id  \
358  2400360    2024  ...  933   
359  2400354    2024  ...  927   
360  2400353    2024  ...  926   
361  2400355    2024  ...  928   
362  2400356    2024  ...  929   

                                         fiba_json_url  
358  https://fibalivestats.dcd.shared.geniussports....  
359  https://fibalivestats.dcd.shared.geniussports....  
360  https://fibalivestats.dcd.shared.geniussports....  
361  https://fibalivestats.dcd.shared.geniussports....  
362  https://fibalivestats.dcd.shared.geniussports....  

[5 rows x 27 columns]

load_cebl_team_boxscore()

from ceblpy.ceblpy import load_cebl_team_boxscore

# Get the team boxscores for 2024
team_boxscore = load_cebl_team_boxscore(2024)
print(team_boxscore.head())
     game_id  season  ... logo_s_width logo_s_bytes
716  2400360    2024  ...          200        16051
717  2400360    2024  ...          200        18967
718  2400354    2024  ...          200        32787
719  2400354    2024  ...          200        24797
720  2400353    2024  ...          200        22272

[5 rows x 75 columns]

load_cebl_player_boxscore()

from ceblpy.ceblpy import load_cebl_player_boxscore

# Get the player boxscores for 2024
player_boxscore = load_cebl_player_boxscore(2024)
print(player_boxscore.head())
      game_id  season  ...                                            photo_t  \
7251  2400360    2024  ...  https://se-img.dcd-production.i.geniussports.c...   
7252  2400360    2024  ...                                                NaN   
7253  2400360    2024  ...                                                NaN   
7254  2400360    2024  ...                                                NaN   
7255  2400360    2024  ...                                                NaN   

                                                photo_s  
7251  https://se-img.dcd-production.i.geniussports.c...  
7252                                                NaN  
7253                                                NaN  
7254                                                NaN  
7255                                                NaN  

[5 rows x 55 columns]

load_cebl_officials()

from ceblpy.ceblpy import load_cebl_officials

# Get the officials for 2024
officials = load_cebl_officials(2024)
print(officials.head())
     game_id  season  ... international_last_name  \
941  2400360    2024  ...                Kerrison   
942  2400360    2024  ...                Stothart   
943  2400360    2024  ...                Toppings   
944  2400354    2024  ...                Turnbull   
945  2400354    2024  ...                Donnelly   

    international_last_name_initial  
941                               K  
942                               S  
943                               T  
944                               T  
945                               D  

[5 rows x 13 columns]

load_cebl_coaches()

from ceblpy.ceblpy import load_cebl_coaches

# Get the coaches for 2024
coaches = load_cebl_coaches(2024)
print(coaches.head())
      game_id  season  ... international_last_name_initial scoreboard_name
1711  2400360    2024  ...                               V       T. Vernon
1712  2400360    2024  ...                               R       W. Rooney
1713  2400360    2024  ...                               B        J. Baker
1714  2400360    2024  ...                               H         G. Hoyt
1715  2400354    2024  ...                               A        L. Abney

[5 rows x 14 columns]

load_cebl_pbp()

from ceblpy.ceblpy import load_cebl_pbp

# Get the pbp for 2024
pbp = load_cebl_pbp(2024)
print(pbp.head())
   game_id  season  ... international_first_name_initial  \
0  2400360    2024  ...                              NaN   
1  2400360    2024  ...                              NaN   
2  2400360    2024  ...                                A   
3  2400360    2024  ...                                D   
4  2400360    2024  ...                                D   

   international_last_name_initial  
0                              NaN  
1                              NaN  
2                                P  
3                                R  
4                                R  

[5 rows x 33 columns]