<jupyter_start><jupyter_text>Import datasets<jupyter_code>DIR = "../../datasets/"

# World Cup Matches
matches = pd.read_csv(DIR+"WorldCupMatches.csv")

# World Cup Players
players = pd.read_csv(DIR+"WorldCupPlayers.csv")

# World Cups
cups = pd.read_csv(DIR+"WorldCups.csv")<jupyter_output><empty_output><jupyter_text>Clean World Cup Matches dataset<jupyter_code>matches.dropna(inplace=True)
matches.info()
matches.head()
matches.columns
new_matches = pd.DataFrame(columns=matches.columns)
for i in range(len(matches)):
    if int(matches.iloc[i]["Year"]) >= 2010:
        new_matches = new_matches.append(matches.iloc[i])
matches = new_matches
matches = matches.reset_index()
matches.drop("index", axis=1, inplace=True)
len(matches)
matches.drop([
    "Year",
    "Datetime",
    "Stadium",
    "City",
    "Win conditions",
    "Referee",
    "Assistant 1",
    "Assistant 2",
    "RoundID",
    "MatchID"
], axis=1, inplace=True)
matches.head()<jupyter_output><empty_output><jupyter_text>Clean World Cup Players dataset<jupyter_code>players.dropna(inplace=True)
players.info()
players.head()
players.drop(["RoundID", "MatchID",
              "Line-up", "Shirt Number",
              "Position", "Event"], axis=1, inplace=True)
players = players.reset_index()
players.drop("index", axis=1, inplace=True)
len(players)<jupyter_output><empty_output><jupyter_text>Remove repetitions<jupyter_code>unique_players = list(players["Player Name"].unique())
new_players = pd.DataFrame(columns=players.columns)

for i in range(len(players)):
    if players.iloc[i]["Player Name"] in unique_players:
        new_players = new_players.append(players.iloc[i])
        unique_players.remove(players.iloc[i]["Player Name"])

players = new_players
len(players)<jupyter_output><empty_output><jupyter_text>Clean World Cups dataset<jupyter_code>cups.dropna(inplace=True)
cups.info()
cups.head()
new_cups = pd.DataFrame(columns=cups.columns)
for i in range(len(cups)):
    if int(cups.iloc[i]["Year"]) >= 2010:
        new_cups = new_cups.append(cups.iloc[i])

cups = new_cups
cups = cups.reset_index()
cups.drop("index", axis=1, inplace=True)
len(cups)<jupyter_output><empty_output><jupyter_text>Save datasets into CSV files<jupyter_code>matches.to_csv("../WorldCupMatches.csv", index=0)
players.to_csv("../WorldCupPlayers.csv", index=0)
cups.to_csv("../WorldCups.csv", index=0)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15690376569037656, 'fraction_numerical': 0.007531380753138075, 'mean_word_length': 5.991228070175438, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, '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': '589195', 'license': 'MIT', 'n_tokens_mistral': 911, 'n_tokens_neox': 893, 'n_words': 135, 'path': 'DataFormating/preprocessing/cleaning.ipynb', 'repo_name': 'shrikant-temburwar/WorldCup-Prediction', 'size': '2390'}