j-andrews7 / kenpompy

A simple yet comprehensive web scraper for kenpom.com.
https://kenpompy.readthedocs.io/en/latest/?badge=latest
GNU General Public License v3.0
70 stars 21 forks source link

FanMatch dates with no games #92

Open seankim658 opened 4 months ago

seankim658 commented 4 months ago

This is sort of a two-case problem.

The first case is you search for FanMatch info on a date where there are no games but is a date within the season (for example, Christmas). In that case, you get a page with no table that just says "Sorry, no games today. :(". In this case, this will crash the FanMatch constructor on line 53: https://github.com/j-andrews7/kenpompy/blob/e28f4b0d5376415781de70efcf0f7918ec2c0428/kenpompy/FanMatch.py#L53.

The second case is you pass a date after the season ends. In this case kenpom just redirects you to the last day of the season (the natty). In this case it would be nice to have a separate date value in the fanmatch class to indicate what day this fanmatch table is actually for. For example:

image

I'm happy to work on these issues and make a pull request, but just wanted to make sure 1) I'm not missing something (definitely possible) or 2) maybe this was explored before and there's a reason why this was left out?

Huge fan of this repository, keep up the good work! Already waiting for next season.

esqew commented 4 months ago

Thanks for the report! I'd agree with the overarching sentiment that these should be smoothed out. The second is just another one those peculiarities that KenPom's got in his code.

My personal preference would be to return an empty DataFrame in both cases to minimize overall impact; a "nice to have" would be emitting a warning indicating what's happening/why an empty DataFrame was returned. However, I'm not married to this course if you (or anyone else) has a better idea.

PRs are absolutely welcome if you have some time to have a think about this.

seankim658 commented 4 months ago

Got it, happy to explore the empty dataframe route.