<jupyter_start><jupyter_text>Preprocessing Kaggle Data  Importing libraries<jupyter_code>import pandas as pd
import numpy as np<jupyter_output><empty_output><jupyter_text>Defining path to data<jupyter_code>path_to_data = "C:/Users/Matheus/Desktop/Github/LEAGUE_RANKED_ANALYSIS/high_diamond_ranked_10min.csv"<jupyter_output><empty_output><jupyter_text>Retrieving data<jupyter_code>df = pd.read_csv(path_to_data, index_col=0)
df.head()<jupyter_output><empty_output><jupyter_text>Dataframe and variable analysis<jupyter_code>df.info()
df.describe()<jupyter_output><empty_output><jupyter_text>VariablesLooking at those 40 variables on our dataset, it is possible to notice that some of them correspond to correlated situations. As an example, we can take the Kills and Deaths of each side: red side kills will be the same as blue side deaths and vice versa.Separating some variables, we can move forward to prepare our dataframe for future analysis. Also, we are looking to answer some main questions with our data, so it is good to look into those repeated variables. Match Variables - 4- blueWins - match winner **(0 - red / 1 - blue)**- blueFirstBlood - match first blood **(0 - red / 1 - blue)**- blueKills - blue side kills **(red side deaths)**- redKills - red side kills **(blue side deaths)** Map Control Variables - 12- blueWardsPlaced, blueWardsDestroyed- blueEliteMonsters- blueTowersDestroyed- blueDragons, blueHeralds- redWardsPlaced, redWardsDestroyed- redEliteMonsters- redTowersDestroyed- redDragons, redHeralds  Side Advantage - 8- blueAssists- blueTotalGold- blueTotalExperience- blueCSPerMin- redAssists- redTotalGold- redTotalExperience- redCSPerMinIt is important to notice that some variables were left behind due to their correspondence in other variables. We can use as an example the Advantage and Diff variables, that can be seen through the total variables difference.  Fixing dataframe<jupyter_code>df_variables = ["blueWins", "blueFirstBlood", "blueKills", "redKills",
                "blueAssists", "redAssists",
                "blueWardsPlaced", "blueWardsDestroyed", "redWardsPlaced", "redWardsDestroyed",
                "blueEliteMonsters", "blueTowersDestroyed", "redEliteMonsters", "redTowersDestroyed",
                "blueDragons", "blueHeralds", "redDragons", "redHeralds",
                "blueTotalGold", "blueTotalExperience", "redTotalGold", "redTotalExperience", 
                "blueCSPerMin", "redCSPerMin"]
main_df = df[df_variables]
rename_variables = {"blueWins": "matchWinner", "blueFirstBlood": "matchFirstBlood"}
main_df = main_df.rename(columns=rename_variables)
main_df.head()<jupyter_output><empty_output><jupyter_text>Last changes on our dataset<jupyter_code>main_df.info()
main_df.describe()
new_path_to_data = "C:/Users/Matheus/Desktop/Github/LEAGUE_RANKED_ANALYSIS/preprocessed_data.csv"
main_df.to_csv(new_path_to_data)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09250343878954607, 'fraction_numerical': 0.004470426409903714, 'mean_word_length': 5.796728971962617, 'pattern_counts': {'":': 2, '<': 25, '<?xml version=': 0, '>': 25, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '410310', 'license': 'MIT', 'n_tokens_mistral': 947, 'n_tokens_neox': 912, 'n_words': 246, 'path': 'preprocessing/preprocessing_data.ipynb', 'repo_name': 'MatheusMAssis/League-Ranked-Analysis', 'size': '2908'}