Created
October 2, 2018 22:16
-
-
Save alaakh42/c1185c9eef19ec18b24cae4bae61705d 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
df = pd.DataFrame({'Team': first_col, | |
'Summary': summary, | |
'History': history, | |
'Team_Page': teams_links, | |
'Location': locations, | |
'Stadium': stadiums, | |
'Stadiums_Capcity': stadiums_capcity | |
}) | |
# crawling the history of those three clubs were somehow tricky so I had to hard code the section names myself | |
df.loc[df['History'].isnull(),'History'] = wikipedia.WikipediaPage(u'FC Barcelona').section(u'1899–1922: Beginnings'),\ | |
wikipedia.WikipediaPage(u'CD Leganés').section(u'History'),\ | |
wikipedia.WikipediaPage(u'Valencia CF').section(u'History') | |
#construct a different variation to the team/ club name | |
Team_alt = pd.Series(['Deportivo Alaves', | |
'Athletic Bilbao', | |
'Atletico Madrid' , | |
'Barca', | |
'RC Celta de Vigo', | |
'SD Eibar', | |
'RCD Espanyol', | |
'Getafe CF', | |
'Girona FC', | |
'SD Huesca', | |
'Leganes', | |
'Levante UD', | |
'Rayo Vallecano', | |
'Real Betis', | |
'Real Madrid CF', | |
'Real Sociedad', | |
'Sevilla FC', | |
'Valencia CF', | |
'Real Valladolid', | |
'Villarreal CF']) | |
df['Team_alt'] = Team_alt.values | |
df.to_csv("data/Teams_data.csv", encoding="utf-8", index=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment