You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
_sort_results raises KeyError when every game in a bulk scrape fails #89
The bulk scrapers (`get_games_range`, `get_games_team`, `get_games_conference`) end with `_sort_results`, which sorts the info frame by `['game_datetime', 'game_id']` (src/cbbpy/utils/cbbpy_utils.py:279). When game IDs exist but every `_get_game` call returns empty frames (e.g. ESPN outage, WAF blocking, all games 404), `pd.concat` of the empty `pd.DataFrame([])` results yields an empty frame with no columns, and `sort_values` raises `KeyError: 'game_datetime'` instead of returning three empty DataFrames.
Master had the same hole (it sorted by `game_day`/`game_time`), so this is not a 2.2.0 regression — but #83 was specifically about failure-path return types, and this is the remaining gap.
Fix
In `_sort_results`, skip sorting any frame that is empty (or lacks the sort columns), so the all-failures path returns `(empty, empty, empty)` like the no-games path does. Add an offline test where every game fetch fails.
Activity
fix for empty df sorting issue #89
dcstats commentedon Jul 23, 2026
fixed with fc25f6f