Skip to content

Instantly share code, notes, and snippets.

@thepycoach
Created November 7, 2022 16:46
Show Gist options
  • Save thepycoach/f0e02d757068dd9cf4aba24b0fd1ab6c to your computer and use it in GitHub Desktop.
Save thepycoach/f0e02d757068dd9cf4aba24b0fd1ab6c to your computer and use it in GitHub Desktop.
import pandas as pd
from string import ascii_uppercase as alphabet
all_tables = pd.read_html("https://en.wikipedia.org/wiki/2022_FIFA_World_Cup")
dict_tables = {}
for letter, i in zip(alphabet, range(11, 67, 7)):
df = all_tables[i]
df.rename(columns={df.columns[1]: 'Team'}, inplace=True)
df.pop('Qualification')
dict_tables[f'Group {letter}'] = df
# show all the keys
print(dict_tables.keys())
# show table of Group H
dict_tables['Group H']
@danydin
Copy link

danydin commented Apr 11, 2023

it doesn't work anymore as intented.. fix the bugs please with the qulifciation and the group H doesn't display correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment