Skip to content

Instantly share code, notes, and snippets.

View MarcoGorelli's full-sized avatar
raise the alarm, climate emergency!

Marco Edward Gorelli MarcoGorelli

raise the alarm, climate emergency!
View GitHub Profile
$ jupyter nbconvert notebooks/hello_world.ipynb --output-dir build
$ jupyter nbconvert notebooks/fibonacci_plot.ipynb --output-dir build --no-input
# source: https://stackoverflow.com/a/28073228/9988333
from IPython.display import HTML
HTML(
"""<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
$ jupyter nbconvert notebooks/fibonacci_plot.ipynb \
--TagRemovePreprocessor.enabled=True \
--TagRemovePreprocessor.remove_input_tags "remove-input" \
--TagRemovePreprocessor.remove_all_outputs_tags "remove-output" \
--no-prompt \
--output-dir build \
--template classic \
--to html
flake8 my_script.py
nbqa flake8 my_notebook.ipynb
@MarcoGorelli
MarcoGorelli / .pre-commit-config.yaml
Last active June 3, 2021 07:12
pre-commit example
- repo: https://github.com/nbQA-dev/nbQA
rev: 0.10.0
hooks:
- id: nbqa-flake8
- id: nbqa-isort
- id: nbqa-mypy
- id: nbqa-black
pip install requests
import requests
import os
data = requests.get('https://api.github.com/search/issues?q=is:pr+repo:pandas-dev/pandas+author:marcogorelli+is:merged').json()
print(f"Merged PRs: {data['total_count']}")
url = 'https://api.github.com/graphql'
query = (
"""
@MarcoGorelli
MarcoGorelli / coin_tossing.py
Last active August 30, 2020 10:58
coin_tossing
import arviz as az
import pymc3 as pm
N = 1000
N_HEADS = 292
with pm.Model() as model:
theta = pm.Beta("θ", alpha=1.0, beta=1.0)
y = pm.Binomial("y", n=N, p=theta, observed=N_HEADS)
trace = pm.sample(return_inferencedata=True)