Skip to content

Instantly share code, notes, and snippets.

View paddymul's full-sized avatar

Paddy Mullen paddymul

View GitHub Profile
@paddymul
paddymul / Exception-Traits-demo.ipynb
Created February 6, 2024 16:15
Showing an attempt at making more sane stack traces from classes using traits heavily
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paddymul
paddymul / gist:0b4201777d09777a43a0095788dd8c1b
Created December 12, 2023 14:23
NFL Division Driving distances
AFC North 632 miles 9h50m
https://www.google.com/maps/dir/Cincinnati,+Ohio/Cleveland,+Ohio/Pittsburgh,+PA/Baltimore,+Maryland/@35.264707,-75.7652801,5z/data=!4m26!4m25!1m5!1m1!1s0x884051b1de3821f9:0x69fb7e8be4c09317!2m2!1d-84.5120196!2d39.1031182!1m5!1m1!1s0x8830ef2ee3686b2d:0xed04cb55f7621842!2m2!1d-81.6943605!2d41.49932!1m5!1m1!1s0x8834f16f48068503:0x8df915a15aa21b34!2m2!1d-79.9958864!2d40.4406248!1m5!1m1!1s0x89c803aed6f483b7:0x44896a84223e758!2m2!1d-76.6121893!2d39.2903848!3e0?entry=ttu
NFC North 767 miles 11h48m
https://www.google.com/maps/dir/minneapolis/green+bay/Chicago,+Illinois/Detroit,+MI/@46.0222098,-90.2532042,6z/data=!4m26!4m25!1m5!1m1!1s0x52b333909377bbbd:0x939fc9842f7aee07!2m2!1d-93.2650108!2d44.977753!1m5!1m1!1s0x8802e2e809b380f3:0x6370045214dcf571!2m2!1d-88.0132958!2d44.5133188!1m5!1m1!1s0x880e2c3cd0f4cbed:0xafe0a6ad09c0c000!2m2!1d-87.6297982!2d41.8781136!1m5!1m1!1s0x8824ca0110cb1d75:0x5776864e35b9c4d2!2m2!1d-83.0457538!2d42.331427!3e0?entry=ttu
AFC South 1371 miles 19h 48m
https://www.google
@paddymul
paddymul / Buckaroo-Unique-Nan-Count.ipynb
Created November 20, 2023 15:24
Showing how to add counts for unique and nan to buckaroo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paddymul
paddymul / Train-calcs.ipynb
Created October 31, 2023 18:42
Alon Levy's train calculator
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paddymul
paddymul / buckaroo-mem-usage.ipynb
Created July 15, 2023 19:34
Memory Usage of bucakroo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

With the new release of buckaroo, df.head() is obsolete. I have worked to make Buckaroo usable as the default table visualization for pandas dataframes. It does this through sensible defaults and down sampling. The default process of investigating a new dataset with pandas and jupyter is to load a dataframe from csv, parquet, or some other data source. The next step is df.head() or df.describe(), if you just type df pandas will try to show the first 5 rows and last 5 rows, and possibly all of the columns. Pandas needs to limit the output to avoid overwhelming a notebook with text output, and causing performance issues. Soon you will find yourself looking up pd.options.display.width = 0 or pd.options.display.max_rows = 500

with pd.option_context('display.max_rows', None, 'display.max_columns', None):
 print (df)

Eventually you will want to look at a subset of rows, using slicing. Looking up sorting… How do I find the rows with the highest or lowest values in a column you could use some

@paddymul
paddymul / hook-add-or-update.el
Created December 31, 2021 18:42
An elisp macro that makes hook development much easier by automatically removing old version of hook
(defmacro hook-add-or-update (hook fname &rest body)
"Macro to make defining and updating hooks much easier.
Hook functions get an fname.
Before defining and adding a hook to a list, macro first checks if that fname is already defined, if so, the old version is removed from hook
used as follows
(hook-add-or-update
shell-mode-hook fourth-shell-hook
(message \"macro fourth rev 2\"))"
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var FlatBush = require("flatbush");
var bbox_1 = require("./bbox");
var SpatialIndex = /** @class */ (function () {
function SpatialIndex(points) {
this.points = points;
this.index = null;
if (points.length > 0) {
this.index = new FlatBush(points.length);
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
class PlotController(object):
def __init__(self):
self.figs = []