This file contains hidden or 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 ( | |
"fmt" | |
"math" | |
) | |
var j int = 10 | |
func Sqrt(x float64) float64 { | |
return math.Sqrt(x) | |
} |
This file contains hidden or 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 | |
# number of rows of dataframe | |
no_rows = len(df) | |
pd.options.display.max_rows = no_rows | |
print(df) | |
# then cut and paste into a text file | |
# and use find and replace to add in the comma's etc |
This file contains hidden or 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
# https://docs.python.org/3/library/inspect.html | |
import inspect | |
print(inspect.getsource(mystery_function)) |
This file contains hidden or 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
# instantiate the app and set the bootstrap theme | |
app = JupyterDash(__name__, external_stylesheets=[dbc.themes.SOLAR]) | |
# layout the app | |
app.layout = html.Div([ | |
html.Br(), | |
# first row | |
dbc.Row([ | |
# title left | |
dbc.Col( |
This file contains hidden or 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
# the sliders | |
sliders = [ | |
# put a blank line at the top | |
html.Br(), | |
# slider 1 | |
dcc.Slider( | |
# set the scale | |
0, 25, | |
value=12.5, | |
id='indy_over_tools', |
This file contains hidden or 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
# the gauge | |
gauge = [daq.Gauge( | |
id='agile-gauge', | |
# make a colour gradient on the scale | |
color={"gradient":True, | |
"ranges":{"green":[0,33], | |
"yellow":[33,66], | |
"red":[66,100]}}, | |
# create a custom scale | |
scale={"custom": { |
This file contains hidden or 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
# setup the proxy | |
JupyterDash.infer_jupyter_proxy_config() |
This file contains hidden or 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
# load python modules | |
import dash_daq as daq | |
import dash_bootstrap_components as dbc | |
import pandas as pd | |
import numpy as np | |
from jupyter_dash import JupyterDash | |
from dash import dcc, html, Input, Output |
This file contains hidden or 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
# install required modules not in Colab by default | |
!pip install --quiet jupyter-dash dash_daq dash-bootstrap-components |
This file contains hidden or 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
def truncate(f, n=2): | |
return math.trunc(f * 10 ** n) / 10 ** n |
NewerOlder