Created
February 19, 2023 19:05
-
-
Save catslovedata/022a0214be162036fd4d3d3c0adbd3cb 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
data = [] | |
def get_coords_from_wiki_page(str) -> list: | |
s = BeautifulSoup(requests.get(str).content, 'html.parser') | |
return s.find(class_='geo').contents[0].split(';') | |
for r in rows: | |
cells = r.find_all('td') | |
shopping_centre = cells[1].a.contents[0] | |
city_town = cells[2].get_text().replace('\n','') | |
region = cells[3].get_text().replace('\n','') | |
size_sq_m = int(cells[4].contents[0].replace(',','')) | |
coords = get_coords_from_wiki_page('https://en.wikipedia.org/'+cells[1].a.get('href')) | |
data.append((str(shopping_centre), city_town, region, size_sq_m, float(coords[0]), float(coords[1]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment