<jupyter_start><jupyter_text>Animal Crossing Cleaning Script<jupyter_code># import libraries
import numpy as np
import pandas as pd
# set options
# changing the display settings
pd.set_option('display.max_columns', None) 
pd.set_option('display.max_rows', None)  
pd.set_option('display.max_colwidth', -1)<jupyter_output>C:\Users\joann\Anaconda3\lib\site-packages\ipykernel_launcher.py:5: FutureWarning: Passing a negative integer is deprecated in version 1.0 and will not be supported in future version. Instead, use None to not limit the column width.
  """<jupyter_text>1. General Data<jupyter_code>general_data = pd.read_csv("Villager_Complete.csv", index_col= 0)
general_data = general_data.reset_index().drop("index", axis=1)<jupyter_output><empty_output><jupyter_text>Name<jupyter_code>general_data["Name"].value_counts()
general_data["Name"] = general_data["Name"].str.title()
general_data["Name"] = general_data["Name"].replace("Spork", "Crackle")<jupyter_output><empty_output><jupyter_text>Gender<jupyter_code>general_data["Gender"].value_counts()
general_data["Gender"] = general_data["Gender"].str.title()<jupyter_output><empty_output><jupyter_text>Personality<jupyter_code>general_data["Personality"].value_counts()
general_data["Personality"] = general_data["Personality"].str.title()<jupyter_output><empty_output><jupyter_text>Species<jupyter_code>general_data["Species"].value_counts()
general_data["Species"] = general_data["Species"].replace("Ostrich, appearance based on Red-Crowned Crane", "Ostrich")
general_data["Species"] = general_data["Species"].str.title()
general_data["Species"].value_counts()<jupyter_output><empty_output><jupyter_text>Horoscope<jupyter_code>general_data["Horoscope"].value_counts()
general_data["Horoscope"] = general_data["Horoscope"].replace("N", "Unknown")
general_data["Horoscope"] = general_data["Horoscope"].apply(lambda x: x.replace("(", ""))
general_data["Horoscope"] = general_data["Horoscope"].apply(lambda x: x.replace(")", ""))
general_data["Horoscope"] = general_data["Horoscope"].str.strip()
general_data["Horoscope"] = general_data["Horoscope"].str.title()
general_data["Horoscope"].value_counts()<jupyter_output><empty_output><jupyter_text>Style<jupyter_code>general_data["Style"].value_counts()
general_data["Style"] = general_data["Style"].apply(lambda x: x.replace("Rock n' roll", "Rock 'n' roll"))
general_data["Style"] = general_data["Style"].apply(lambda x: x.replace("Rock'n'roll", "Rock 'n' roll"))
general_data["Style"] = general_data["Style"].apply(lambda x: x.replace("Rock 'n' Roll", "Rock 'n' roll"))
general_data["Style"] = general_data["Style"].str.title()
general_data["Style"].value_counts()<jupyter_output><empty_output><jupyter_text>Favorite Song<jupyter_code>general_data["Favorite_Song"].value_counts()
general_data["Favorite_Song"] = general_data["Favorite_Song"].replace("[[K.K. Ragtime Neopolitan (NH)]]", "K.K. Ragtime Neopolitan")
general_data["Favorite_Song"] = general_data["Favorite_Song"].replace("Two Days Ago (Neapolitan in New Horizons)", "Neapolitan")
general_data["Favorite_Song"] = general_data["Favorite_Song"].replace("[[K.K. D & B ACPondering NL]]", "K.K. D & B")
general_data["Favorite_Song"] = general_data["Favorite_Song"].replace("K.K. D&B", "K.K. D & B")
general_data["Favorite_Song"] = general_data["Favorite_Song"].replace("[[Space K.K.(NL) K.K. Bossa(NH)]]", "K.K. Bossa")
general_data["Favorite_Song"] = general_data["Favorite_Song"].replace("[[K.K. Bossa (Animal Crossing)K.K. Synth (New Leaf)]]", "K.K. Synth")
general_data["Favorite_Song"] = general_data["Favorite_Song"].replace("Aloha K.K. (AC)K.K. Lament (NL)]]", "K.K. Lament")
general_data["Favorite_Song"] = general_data["Favorite_Song"].replace("[[K.K. SynthK.K. Disco (NH)]]", "K.K. Disco")
general_data["Favorite_Song"] = general_data["Favorite_Song"].str.strip()
general_data["Favorite_Song"] = general_data["Favorite_Song"].str.title()
general_data["Favorite_Song"].value_counts()<jupyter_output><empty_output><jupyter_text>Skills<jupyter_code>general_data["Skill"] = general_data["Skill"].str.title()<jupyter_output><empty_output><jupyter_text>Goal<jupyter_code>general_data["Goal"] = general_data["Goal"].str.title()<jupyter_output><empty_output><jupyter_text>Style<jupyter_code># write to file
general_data.to_csv("Clean_Animal_Crossing_General.csv")<jupyter_output><empty_output><jupyter_text>2. Tier Data<jupyter_code># read the completed clean data
general_data = pd.read_csv("Animal_Crossing_Full_Data.csv")
tier_data = pd.read_csv("Villager_Data_16_May_2020.csv")
tier_data = tier_data.rename(columns={"Unnamed: 0":"Rank_Overall"})
tier_data.head()
tier_data["Name"].value_counts()
tier_data["Name"] = tier_data["Name"].replace("Crackle(Spork)", "Crackle")
tier_data["Name"] = tier_data["Name"].replace("Buck(Brows)", "Buck")<jupyter_output><empty_output><jupyter_text>Merge Rank with General Data<jupyter_code>full_data = general_data.merge(tier_data, left_on="Name", right_on="Name", how="outer")
full_data
full_data.to_csv("Animal_Crossing_Full_Data.csv")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17550778939065273, 'fraction_numerical': 0.0031551962137645437, 'mean_word_length': 11.370731707317074, 'pattern_counts': {'":': 1, '<': 56, '<?xml version=': 0, '>': 56, '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': '14', 'dir': 'jupyter-structured-clean-dedup', 'id': '70653', 'license': 'MIT', 'n_tokens_mistral': 1884, 'n_tokens_neox': 1800, 'n_words': 234, 'path': 'Animal Crossing Villager Insights/Data/.ipynb_checkpoints/Animal Crossing Cleaning-checkpoint.ipynb', 'repo_name': 'Joanna-Khek/joanna-khek.github.io', 'size': '5071'}