<jupyter_start><jupyter_text>Scrape the flags<jupyter_code>for i, table in enumerate(soup.find_all('table')):
    j = 0
    arr = np.empty(23, dtype='object')
    for tag in table.find_all('span', {"class": "flagicon"}):
        if tag.a is None:
            continue
        arr[j] = tag.img['alt']
        j += 1
    teams[i]["Country"] = arr
    if i == 31:
        break<jupyter_output><empty_output><jupyter_text>Scrape team names<jupyter_code>i = 0
arr = np.empty(32, dtype='object')
for tag in soup.find_all("h3"):
    for t in tag.find_all("span", {"class": "mw-headline"}):
        arr[i] = t.text
        i += 1
    if i == 32:
        break
for team, team_df in zip(arr, teams):
    team_df["Team"] = team
df = pd.concat(teams)    
DOB = "Date of birth (age)"
def age_separator(row):
    match = re.search(r'[0-9-]{10}', row[DOB])
    row["DOB"] = match.group()
    match = re.search(r'(?<=aged )\d+', row[DOB])
    row["age"] = match.group()
    return row


df = df.apply(age_separator, axis=1)
df.drop(DOB, axis=1, inplace=True)
df.age = df.age.astype('int')
df.DOB = pd.to_datetime(df.DOB)
df.to_csv("data/squads.csv", encoding='utf-8')
fig = plt.figure(figsize=(12,8))
sns.distplot(df.age, color='r')
plt.savefig('dist.png', dpi=600)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18999218139171228, 'fraction_numerical': 0.020328381548084442, 'mean_word_length': 3.4444444444444446, 'pattern_counts': {'":': 2, '<': 10, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '190341', 'license': 'MIT', 'n_tokens_mistral': 534, 'n_tokens_neox': 513, 'n_words': 105, 'path': 'wcup_notebook.ipynb', 'repo_name': 'eugenekoran/web_scraping.wcup', 'size': '1279'}