Skip to content

Instantly share code, notes, and snippets.

@mrtolkien
Last active November 1, 2019 17:30
Show Gist options
  • Save mrtolkien/a919fa9ab117a381f7d5f5e6834816e0 to your computer and use it in GitHub Desktop.
Save mrtolkien/a919fa9ab117a381f7d5f5e6834816e0 to your computer and use it in GitHub Desktop.
import splyce_lol_data_commons as sp
from collections import defaultdict, Counter
import datetime
blind_picks = defaultdict(lambda: Counter()) # Very convenient data structure for counting
session = sp.get_read_session() # SQLAlchemy session
team_name = 'SK Telecom T1'
start_date = datetime.date.fromisoformat('2019-06-01'))
# First, we get all the games objects as well as the chosen team's id in those games
all_team_games = session.query(sp.EsportsGame, sp.EsportsGameTeam.team_id)\
.join(sp.EsportsGameTeam)\
.filter(sp.EsportsGameTeam.team_name == team_name)\
.filter(sp.EsportsGame.date > start_date)
# Then we iterate on every game
for e_game, team_id in all_team_games:
# And iterate on each participant (player) in the game
for participant in e_game.participants:
if not sp.is_counter_pick(e_game, participant) and participant.team_id == team_id:
champion_name = sp.id_getter.get_champion_name(participant.champion_id)
blind_picks[participant.role][champion_name] += 1
pprint.pprint(blinds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment