Skip to content

Instantly share code, notes, and snippets.

View colby-schrauth's full-sized avatar

Colby Schrauth colby-schrauth

View GitHub Profile
/* INTRODUCTION
--------------------------------------------------
Product recently launched a referral program, and their hoping to track progress through a dashboard.
Each referral link distributed gets tracked, and if used, both parties receive a beneift.
DB Tables Explored:
- public.referral_links
- public.referral_purchases
- public.users
@colby-schrauth
colby-schrauth / sql_exploration_qa_template.sql
Last active June 5, 2017 02:12
SQL Exploration and QA Template
/* INTRODUCTION
--------------------------------------------------
Enter primary exploration reason here
Enter additional comments here, if needed
DB Table(s) Explored:
db.table_one
db.table_two
db.table_three
@colby-schrauth
colby-schrauth / lorenz_and_gini.py
Last active July 25, 2017 10:35
lorenz_and_gini
# Import necessary libraries
from __future__ import division
import numpy as np
import pandas as pd
# Load dataset and store dataframe in variable 'df'
# 25 randomly selected income values w/ a range of $50k – $250k
df = pd.read_csv('http://bit.ly/2eaP6ny', header = None)
df = df
@colby-schrauth
colby-schrauth / useful_pandas_snippets.py
Last active January 28, 2016 02:49 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]