Skip to content

Instantly share code, notes, and snippets.

View jeremystan's full-sized avatar

Jeremy Stanley jeremystan

View GitHub Profile
@jeremystan
jeremystan / retry.py
Last active September 14, 2020 17:13
A python class for retrying flickering unit tests up to a maximum number of times.
import functools
import logging
class RetryTest:
"""
Decorator for re-trying flickering tests multiple times
to attempt to get them to pass.
Note that it creates a new copy of the test class for each
"""
This is an example python class that can be used to create SQL that will pivot data SQL
query-able database (such as Redshift).
Note that it uses an Anomalo library, dquality.db, which is not open-sourced. However,
you can replace the calls to self.db and DB with the appropriate calls for your warehouse
to construct and execute SQL queries.
"""
import logging
@jeremystan
jeremystan / decision_tree_root_cause.py
Created July 7, 2021 15:09
Decision Tree Root Cause Analysis
import graphviz
import pandas as pd
import numpy as np
import sklearn.impute
import sklearn.tree
# Load the data from disk
df_good = pd.read_csv("~/Downloads/good_data_sample.csv")
df_bad = pd.read_csv("~/Downloads/bad_data_sample.csv")