This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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)] |