<jupyter_start><jupyter_text>Step 1: Import necessary packages<jupyter_code>from decouple import config
import brawlstats as brawl
import pandas as pd<jupyter_output><empty_output><jupyter_text>Step 2: Connect to the API and get my playerdata<jupyter_code>try:
    TOKEN = config('TOKEN')
    client = brawl.Client(TOKEN)
    player = client.get_player("2GGYGV8YQ")
    print("Connected successfully and returned player: ",player.name)
except:
    print("an error occured with connection")<jupyter_output>Connected successfully and returned player:  Zuki<jupyter_text>Step 3: Put the playerdata into a usable data structure<jupyter_code>df = pd.DataFrame(player.brawlers)#read the brawlers list from my player data
df.drop(columns=['id'], inplace=True)#drop the brawler id columns
df = df[['name','trophies','gadgets','power', 'highest_trophies',   'rank', 'star_powers', ]]#reorder columns
for index, row in df.iterrows():#loop through the dataframe
    dicList = row["gadgets"]#get the list from the column
    for i in range(len(dicList)):#loop through the list
        if(type(dicList[i])!= str):#if the list item is a dictionary and not a string
            item = dicList[i]['name']#get the name from the dictionary
            dicList[i] = item#replace the list with just the name
    df.at[index,'gadgets'] = dicList#update the dataframe with the new list
    powerList = row["star_powers"]#DO THE SAME FOR GADGETS
    for i in range(len(powerList)):
        if(type(powerList[i])!= str):
            item = powerList[i]['name']
            powerList[i] = item
    df.at[index,'star_powers'] = powerList
df.sort_values(by=['trophies'], ascending=False)#sort by trophies, highest-lowest<jupyter_output><empty_output><jupyter_text>Step 4: Use the playerdata to find some meaningful information  Meaningful information no.1: try to find who has a lower trophy count than expected which indicates which brawlers will be easier to gain trophies on. in order to find the brawlers with low trophies, I have to define what the expected trophy count should be:since power 10 is the maximum power, and is only achieved with the existence of a star power, we can say that a hero with a gadget and is power 10 should be able to acheieve the maximum trophie count (550 trophies is the limit of trophies as extras are removed every few weeks for rewards). we can then arbritrarily say that a brawler with ((powerlevel-1)+(1 if the brawler has a gadget)) x 10% is the percentage of trophies that a brawler is expected to have out of 550<jupyter_code>#edit the dataframe to contain only necessary information
maxTrophies = 550
estimateDF = df.copy()
estimateDF.drop(columns=['star_powers','rank','highest_trophies'], inplace=True)
for index, row in estimateDF.iterrows():#loop through the dataframe
    gagExist = 0
    gList = row["gadgets"]#get the list from the column
    if(len(gList)>0):
        gagExist = 1
    estimateDF.at[index,'gadgets'] = gagExist
#find the estimate and insert it into the dataframe
for index, row in estimateDF.iterrows():
    powerLevel = row['power']
    gagExist = row["gadgets"]
    troph = row['trophies']
    estimate = ((powerLevel-1)+gagExist)/10
    trophyEstimate = estimate * maxTrophies
    estimateDF.at[index,'trophyEstimate'] = trophyEstimate
    estimateDF.at[index,'trophyError'] = troph-trophyEstimate
estimateDF.sort_values(by=['trophyError'])#sort by error, most-least<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0964835803545481, 'fraction_numerical': 0.008718395815170008, 'mean_word_length': 4.873720136518771, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '455336', 'license': 'MIT', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1054, 'n_words': 368, 'path': 'ProjectOutline.ipynb', 'repo_name': 'HarveySouth/BrawlStars-Statistics', 'size': '3441'}