(project name) will solve your problem of _____ by providing _____ and allowing _____.
Look how easy it is to use (code example follows):
import project
# get your stuff done
project.do_stuff()
# assumes you already made a chart with Bokeh and it is assigned to a variable, chart1 | |
# added code for exporting the chart as HTML + JS | |
# https://bokeh.pydata.org/en/latest/docs/user_guide/embed.html | |
from bokeh.plotting import figure | |
from bokeh.resources import CDN | |
from bokeh.embed import file_html | |
# create a complete HTML file | |
html = file_html(chart1, CDN, "bokeh_chart01") |
import sqlite3 | |
# no need to pip-install; comes w/ Python 3 | |
# from https://www.youtube.com/watch?v=o-vsdfCBpsU | |
# db connection | |
# it's fine if the db named here doesn't exist yet - will be created | |
conn = sqlite3.connect('tutorial.db') | |
# define cursor |
percentiles = [10, 20, 30, 40, 50, 60 ,70, 80, 90] | |
all_scores = [44, 49, 54, 56, 62, 66, 67, 70, 72, 73, 73, 77, 80, 81, 83, 85, 85, 85, 89, 90, 96] | |
percentiles_with_scores = {k: [] for k in percentiles} | |
score_percentiles = tuple(zip(np.percentile(all_scores, percentiles), percentiles)) | |
# let's see what's what | |
print("Tuples:") | |
print(score_percentiles) | |
print("The dictionary:") |
# To define a function, you write something in this pattern: | |
def name_of_function(arg1, arg2): | |
instructions | |
instructions | |
instructions | |
... | |
return something | |
# the number of arguments in parentheses may be none, or one, or any number |
<style> | |
svg { | |
background-color: pink; | |
} | |
</style> | |
<body> | |
<script> | |
const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9]; | |
const w = 500; |
<style> | |
.bar { | |
width: 25px; | |
height: 100px; | |
display: inline-block; | |
background-color: blue; | |
/* extra style */ | |
margin-right: 5px; | |
} | |
</style> |
# copy a column from a table into a plain-text file in Atom, save it | |
# mine is named states.txt | |
# here's how to get each line in that file into Python as a list of items | |
myfile = open('states.txt') | |
states_raw = myfile.readlines() | |
# now states_raw holds a list made from lines in states.txt | |
myfile.close() |
from bs4 import BeautifulSoup | |
import requests | |
url = 'http://whc.unesco.org/en/list/937' | |
html = requests.get(url) | |
soup = BeautifulSoup(html.text, 'html.parser') | |
# <div class="alternate"> | |
box = soup.find( "div", {"class":"alternate"} ) | |
# print(box) |
import time | |
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
from bs4 import BeautifulSoup | |
chrome_options = Options() | |
chrome_options.add_argument("--headless") | |
# fill in your own path to installed chromedriver | |
driver = webdriver.Chrome(executable_path='/Users/dirname/dirname/dirname//chromedriver', | |
options=chrome_options) |