Skip to content

Instantly share code, notes, and snippets.

View kennethbruskiewicz's full-sized avatar

Kenneth Bruskiewicz kennethbruskiewicz

  • Vancouver, Canada
View GitHub Profile
@kennethbruskiewicz
kennethbruskiewicz / everyDrugTheyTake_pearsonCorrelation.tsv
Last active March 2, 2019 17:31
Pearson Correlation between drug categories in
Drug_0 Drug_1 Correlation
ALCEVER ALCEVER 1
ANLEVER ALCEVER 0.211840172
BLNTEVER ALCEVER 0.328981944
CIGEVER ALCEVER 0.531660634
COCEVER ALCEVER 0.219352848
CRKEVER ALCEVER 0.098581456
HEREVER ALCEVER 0.078915182
INHEVER ALCEVER 0.129854299
MJEVER ALCEVER 0.484604210
@kennethbruskiewicz
kennethbruskiewicz / pre-processing.py
Last active March 2, 2019 17:00
Processing "National Survey on Drug Use and Health" for particular columns using Pandas
# Pandas has good support for manipulating dataframes as is cost-efficient at doing so.
# By comparison I couldn't process the file in Excel because it was too large.
import pandas as pd
# Load the TSV file using a tab delimeter
df = pd.read_csv("35509-0001-Data.tsv", sep='\t')
# The filter function slices columns from the dataset. Each column was
df.filter(items=["CASEID", "CIGEVER", "SNFEVER", "CHEWEVER", "PIPEVER", "ALCEVER", "MJEVER", "COCEVER", "CRKEVER", "HEREVER", "INHEVER", "ANLEVER", "STMEVER", "SEDEVER", "BLNTEVER", "TRNEVER"])
@kennethbruskiewicz
kennethbruskiewicz / everyDrugTheyTake_stacked.tsv
Last active March 2, 2019 20:50
Filtering "National Survey on Drug Use and Health" by whether or not someone has ever used a kind of drug
We can't make this file beautiful and searchable because it's too large.
CASEID Drug Taken
1 CIGEVER 1
1 SNFEVER 0
1 CHEWEVER 0
1 PIPEVER 0
1 ALCEVER 0
1 MJEVER 0
1 COCEVER 0
1 CRKEVER 0
1 HEREVER 0