Created
November 7, 2022 16:46
-
-
Save thepycoach/f0e02d757068dd9cf4aba24b0fd1ab6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it doesn't work anymore as intented.. fix the bugs please with the qulifciation and the group H doesn't display correctly