Skip to content

Instantly share code, notes, and snippets.

@camriddell
camriddell / collect_univariates.py
Last active July 26, 2025 15:36
A collection of univariate plots
from functools import partial
from textwrap import fill
from scipy.stats import norm, uniform, skewnorm, gaussian_kde, triang
from numpy import (
array, linspace, quantile, histogram, atleast_2d, mean, std, add
)
from numpy.lib.stride_tricks import sliding_window_view
from matplotlib.pyplot import subplots, show, rc
```python
from matplotlib.pyplot import figure, subplots, show, rc, rcdefaults
from numpy.random import default_rng
from numpy import linspace, atleast_2d
from pandas import DataFrame
from scipy.stats import gaussian_kde
from seaborn import stripplot, rugplot
rcdefaults()
rc('font', size=14)
@camriddell
camriddell / inset_axes_example.png
Last active September 1, 2023 17:27
Example of how one can use matplotlib transforms to inset an axes along each bar of a bar chart.
inset_axes_example.png
@ChronoJon
ChronoJon / pandas_assignment.ipynb
Created April 12, 2022 22:58
Exploring assignments with multiindex column dataframes and subset assignment
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nicolevanderhoeven
nicolevanderhoeven / downloadfirebase.py
Last active June 4, 2025 11:44
Download Roam images locally for use with Obsidian vault
# Opens files in directory, outputs firebase URLs to a file, downloads them, and replaces the links with a link to the new files.
# To use, replace PATH in the variable vaultDir with your vault's root directory.
# This automatically puts filenames in /assets - change the newFilePath variable if you want to change this
import re
import glob
import os
import requests
import calendar
import time
@jseabold
jseabold / Difference_in_Differences_Differences.ipynb
Last active March 14, 2021 18:13
Working out some differences between R and Python for Causal Inference: The Mixtape
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@elliottmorris
elliottmorris / election_night_live_model.R
Last active January 29, 2024 18:56
A live election-night prediction model using The Economist's pre-election forecast
#' Description
#' This file runs a live election-night forecast based on The Economist's pre-election forecasting model
#' available at projects.economist.com/us-2020-forecast/president.
#' It is resampling model based on https://pkremp.github.io/update_prob.html.
#' This script does not input any real election results! You will have to enter your picks/constraints manually (scroll to the bottom of the script).
#'
#' Licence
#' This software is published by *[The Economist](https://www.economist.com)* under the [MIT licence](https://opensource.org/licenses/MIT). The data generated by *The Economist* are available under the [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/).
#' The licences include only the data and the software authored by *The Economist*, and do not cover any *Economist* content or third-party data or content made available using the software. More information about licensing, syndication and the copyright of *Economist* content can be fou
@ih2502mk
ih2502mk / list.md
Last active August 18, 2025 10:57
Quantopian Lectures Saved