Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Formatting | |
# Remove borders | |
for s in (ax.spines['top'], ax.spines['right'], ax.spines['bottom'], ax.spines['left'], ax2.spines['top'], ax2.spines['right'], ax2.spines['bottom'], ax2.spines['left']): | |
s.set_visible(False) | |
# Force all the dates to show on the x axis | |
ax2.set_xticks(data['python_date']) |
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
# Set some color constants | |
COLOR_RED = '#dc322f' | |
COLOR_GREEN = '#2aa198' | |
COLOR_VLINES = '#073642' | |
COLOR_VOLUME = '#268bd2' | |
COLOR_AXES = '#657b83' | |
COLOR_TITLE = '#002b36' | |
COLOR_BACKGROUND = '#f6f6f6' |
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 numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import matplotlib.font_manager as fm | |
from datetime import datetime, timedelta | |
# Set the seed for reproducibility | |
np.random.seed(300) | |
# Dates |
This file has been truncated, but you can view the full file.
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
<html> | |
<head><meta charset="utf-8" /></head> | |
<body> | |
<div> <script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script> | |
<script type="text/javascript">/** | |
* plotly.js v2.18.0 | |
* Copyright 2012-2023, Plotly, Inc. | |
* All rights reserved. | |
* Licensed under the MIT license | |
*/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 plotly.io as pio | |
import plotly.express as px | |
pio.renderers.default = 'notebook' | |
# px.set_mapbox_access_token('SET_ME') | |
fig = px.scatter_mapbox( | |
df, | |
lat='latitude', | |
lon='longitude', |
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 | |
df = pd.DataFrame(data, columns=['shopping_centre', 'city_town', 'region', 'size_sq_m', 'latitude', 'longitude']) |
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','') |
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 requests | |
from bs4 import BeautifulSoup | |
c = requests.get('https://en.wikipedia.org/wiki/List_of_shopping_centres_in_the_United_Kingdom_by_size').content | |
s = BeautifulSoup(c, 'html.parser') | |
rows = s.table.find_all('tr')[1:] |
NewerOlder