Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeremy Stanley jeremystan

View GitHub Profile
@jeremystan
jeremystan / decision_tree_root_cause.py
Created Jul 7, 2021
Decision Tree Root Cause Analysis
View decision_tree_root_cause.py
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")
View pivot_sql_example.py
"""
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 / retry.py
Last active Sep 14, 2020
A python class for retrying flickering unit tests up to a maximum number of times.
View retry.py
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