Skip to content

Commit

Permalink
Merge pull request #22 from nathanblumenfeld/njb_dev
Browse files Browse the repository at this point in the history
+examples notebook, docs update
  • Loading branch information
nathanblumenfeld authored Sep 2, 2022
2 parents 4045f3b + 25b8882 commit eb3e5b8
Show file tree
Hide file tree
Showing 13 changed files with 12,267 additions and 8 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include DESCRIPTION.rst
include *.parquet
include *.csv
recursive-include collegebaseball/data *
6 changes: 5 additions & 1 deletion collegebaseball/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .ncaa_scraper import ncaa_team_season_roster, ncaa_team_roster, \
ncaa_career_stats, ncaa_team_stats, ncaa_team_totals, \
ncaa_team_game_logs, ncaa_player_game_logs
ncaa_team_game_logs, ncaa_player_game_logs, ncaa_team_results
from .lookup import lookup_season_ids, lookup_season_reverse, \
lookup_season_id, lookup_seasons_played, lookup_school, \
lookup_player, _lookup_season_info, _lookup_school_info, \
Expand All @@ -17,6 +17,10 @@
get_seasons_path, get_seasons_table, \
get_rosters_path, get_rosters_table, \
get_season_linear_weights
from .download_utils import download_rosters, \
download_player_game_logs, download_season_rosters, \
download_team_results, download_team_stats, \
download_team_totals

import sys
import warnings
Expand Down
5 changes: 3 additions & 2 deletions collegebaseball/boydsworld_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ def boydsworld_team_results(school, start, end=None, vs="all",
Args:
school (str): team whose games to select
start (int): the start year of games, 1992 <= start <= 2021
end (int): the end season of games, 1992 <= end <= 2021
start (int): the start year of games, 1992 <= start <= 2022
end (int): the end season of games, 1992 <= end <= 2022
vs (str): school to filter games against. default: 'all'
parse_dates (bool): whether to parse data into datetime64
Expand Down
2 changes: 1 addition & 1 deletion collegebaseball/download_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def download_team_stats(seasons: list[int], variant: str, divisions: list[int],
if save:
res.to_csv('collegebaseball/data/d'+str(division)+'_'+str(season) +
'_'+variant+'_stats.csv', index=False)
return res, failures
return res


def download_team_totals(seasons: list[int], variant: str, divisions: list[int], save=True):
Expand Down
1 change: 1 addition & 0 deletions docs/source/gamelogs.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
==================
Game-by-Game Stats
==================

Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
===========================================
Welcome to collegebaseball's documentation!
===========================================

Expand Down
1 change: 1 addition & 0 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
============
Installation
============

Expand Down
1 change: 1 addition & 0 deletions docs/source/lookup.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
================
Lookup Functions
================

Expand Down
1 change: 1 addition & 0 deletions docs/source/metrics.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
=======
Metrics
=======

Expand Down
6 changes: 4 additions & 2 deletions docs/source/results.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
============
Game Results
============

Expand All @@ -17,12 +18,13 @@ Team Results
A function to scrape Division I game results, from boydsworld.com

:school (str): team whose games to select
:start (int): the start year of games, 1992 <= x <= 2021
:end (int, optional): the end season of games, 1992 <= x <= 2021
:start (int): the start year of games, 1992 <= x <= 2022
:end (int, optional): the end season of games, 1992 <= x <= 2022
:vs (str, optional): school to filter games against. default: 'all'
:parse_dates (bool, optional): whether to parse data into datetime64
:return (pd.DataFrame): of all games played for a given team inclusive of start & end


.. py:function:: win_pct.calculate_actual_win_pct(games):
A function to calculate the winning percentage as
Expand Down
4 changes: 2 additions & 2 deletions docs/source/schools.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
====================
School Names and IDs
=====================

====================

=================================== ================================= ============ ===========
ncaa_name bd_name school_id division
Expand Down
1 change: 1 addition & 0 deletions docs/source/season_stats.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
============
Season Stats
============

Expand Down
12,245 changes: 12,245 additions & 0 deletions examples.ipynb

Large diffs are not rendered by default.

0 comments on commit eb3e5b8

Please sign in to comment.