boknows.utils

boknows.utils.csv_cleanup(content)

Cleans up the csv output from NCAA stats. Separates different tables into individual strings.

Returns a tuple with filename and csv content.

Parameters:content – Original output from NCAA stats
boknows.utils.csv_dump(dir_path='dump', sport_code='MBB', academic_year='latest', rpt_weeks='latest', div='1', stat_seq='team')

Dumps a csv file according to inputs to specified path. Most inputs are based on arbitrary NCAA codes that users should not have to know (except for maybe sport_code).

Parameters:dir_path – Path to directory to dump CSV files in. Defaults to directory called ‘dump’

Other inputs documented in boknows.utils.ncaa_request().

boknows.utils.get_ncaa_data(sport_code, div, stat_seq, academic_year='latest', rpt_weeks='latest')

Gets NCAA data in CSV format with minimal input. Uses rudimentary caching by simply loading from file if it has already been created and stored in default directory.

All inputs defined in boknows.utils.ncaa_request() function. Defaults academic_year and rpt_weeks to ‘latest’.

boknows.utils.ncaa_request(rpt_type, sport_code, academic_year, rpt_weeks, div, stat_seq)

Makes request to NCAA web application at http://web1.ncaa.org/stats/StatsSrv/rankings.

Parameters:
  • rpt_type – Format of response. Can be HTML, ASCII, PDF or CSV.
  • sport_code – NCAA code for desired sport.
  • academic_year – Numerical four digit academic year or ‘latest’. Earliest input is 2002.
  • rpt_weeks – Numerical NCAA code for end week of returned stats or ‘latest’.
  • div – NCAA division.
  • stat_seq – NCAA code for specific stats requested. Generic terms ‘team’ and ‘player’ will return all team or individual stats.