SAVE_FILENAME = 'stats.csv' FULL_AP_ITEMS = util.FULL_AP_ITEMS REGIONS = util.REGIONS_SHORT REGION_DICT = util.REGION_DICT REVERSE_REGION_DICT = util.REVERSE_REGION_DICT PATCHES = util.PATCHES # Create dictionaries from codes to names and vice-versa for items and champs. item_data = rawpi.get_item_list('na').json()['data'] ITEM_DICT = {i: item_data[i]['name'] for i in item_data.keys()} REVERSE_ITEM_DICT = {ITEM_DICT[i]: i for i in ITEM_DICT} champ_data = rawpi.get_champion_list('na').json()['data'] CHAMP_DICT = {champ_data[name]['id']: name for name in champ_data} # Define methods for creating DataFrame rows. These are structured as dicts # with keys being column names and values being DataFrame values. These methods # function by passing a dictionary and adding to them. This dictionary can then # be added to a list that a DataFrame can be created from. def get_item_purchases(timeline): """ Given a timeline json object, returns a dictionary of participant ID: [list of item purchases] pairs. List will be sorted in chronological order. Keyword argument:
import itertools import json import os import sys sys.path.append('C:\\Python33\\RIOTAPICHALLENGE\\lolapi-master') import rawpi import math data = "C:\\Python33\\RIOTAPICHALLENGE\\GAME_DATA_FILES" pre_ap_changes = "\\5.11" post_ap_changes = "\\5.14" norms = "\\NORMAL_5X5" ranked = "\\RANKED_SOLO" champion_list = rawpi.get_champion_list('na', dataById=True).json()["data"] final_data = open('C:\\Python33\\RIOTAPICHALLENGE\\final_data.json') working_data = json.load(final_data) final_data.close() final_polished_data = open("C:\\Python33\\RIOTAPICHALLENGE\\db_data.json") working_final_polished_data = json.load(final_polished_data) final_polished_data.close() #input should be a list of stuff def sample_mean(sample): return sum(sample)/len(sample) def sample_variance(sample):
FULL_AP_ITEMS = util.FULL_AP_ITEMS REGIONS = util.REGIONS_SHORT REGION_DICT = util.REGION_DICT REVERSE_REGION_DICT = util.REVERSE_REGION_DICT PATCHES = util.PATCHES # Create dictionaries from codes to names and vice-versa for items and champs. item_data = rawpi.get_item_list('na').json()['data'] ITEM_DICT = {i: item_data[i]['name'] for i in item_data.keys()} REVERSE_ITEM_DICT = {ITEM_DICT[i]: i for i in ITEM_DICT} champ_data = rawpi.get_champion_list('na').json()['data'] CHAMP_DICT = {champ_data[name]['id']: name for name in champ_data} # Define methods for creating DataFrame rows. These are structured as dicts # with keys being column names and values being DataFrame values. These methods # function by passing a dictionary and adding to them. This dictionary can then # be added to a list that a DataFrame can be created from. def get_item_purchases(timeline): """ Given a timeline json object, returns a dictionary of participant ID: [list of item purchases] pairs. List will be sorted in chronological order.