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 logging | |
# Create a custom logger | |
logger = logging.getLogger(__name__) | |
# Create a handler | |
f_handler = logging.FileHandler('file.log') | |
# Create a formatter and add it to the handler | |
f_format = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') |
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 dash_html_components as html | |
import dash_table | |
import pandas as pd | |
def data_table(df): | |
table = html.Div( | |
className='table table-responsive-md p-3', | |
children=dash_table.DataTable( | |
id='tabella-milano', |
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
# Does NOT implement the PEP 249 spec, but the return type is suggested by the .fetchall function as specified here: https://www.python.org/dev/peps/pep-0249/#fetchall | |
import time | |
import boto3 | |
# query_string: a SQL-like query that Athena will execute | |
# client: an Athena client created with boto3 | |
def fetchall_athena(query_string, client): | |
query_id = client.start_query_execution( | |
QueryString=query_string, |
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
biblioCode | Biblioteca | Titoli unici prestati | Titoli in catalogo | Percentuale titoli prestati sul catalogo | |
---|---|---|---|---|---|
RM0635 | BIBLIOTECA GUGLIELMO MARCONI | 16425 | 61117 | 26.9 % | |
RM0627 | BIBLIOTECA NELSON MANDELA | 11968 | 33639 | 35.6 % | |
RM0632 | BIBLIOTECA ELSA MORANTE | 11561 | 30479 | 37.9 % | |
RM0621 | BIBLIOTECA ENNIO FLAIANO | 10937 | 21268 | 51.4 % | |
RM1417 | BIBLIOTECA CORNELIA | 10287 | 29942 | 34.4 % | |
RM1453 | BIBLIOTECA SANDRO ONOFRI | 9609 | 32044 | 30.0 % | |
RM0633 | BIBLIOTECA FRANCO BASAGLIA | 9595 | 30874 | 31.1 % | |
RM1485 | BIBLIOTECA EUROPEA | 9275 | 27930 | 33.2 % | |
RM1149 | BIBLIOTECA GIANNI RODARI | 9207 | 27141 | 33.9 % |
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 selenium import webdriver | |
from selenium.webdriver.firefox.options import Options | |
opts = Options() | |
opts.headless = True | |
driver = webdriver.Firefox(executable_path='../geckodriver', options=opts) | |
def crawler(codice_isbn): | |
driver.get('https://opac.sbn.it/opacsbn/opac/iccu/avanzata.jsp') | |
print(f'Titolo della pagina: {driver.title}') |
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
pd.read_csv('https://www.metoffice.gov.uk/pub/data/weather/uk/climate/datasets/Tmin/ranked/UK.txt?fbclid=IwAR26RJZPfZYJd4GJ5bn4zmAHlXkGmDj4UPxujCIgLWFW5ErgM9AWkmpG_IM',\ | |
skiprows=6, \ | |
sep=' ') |