Recently Updated Pages
Idioms and words
everything but the kitchen sink through thick and thin stowaway joust scrape the bottom of the ba...
Working with Dates and Times
Data Types for Dates and Times data type description timestamp records date and time times...
Statistical Functions in SQL
Correlation SELECT corr(med_hh_inc, pct_bach_higher) FROM acs_2014_2018_stats; corr --...
Modifying Data + Transactions
Modifying Tables with ALTER TABLE -- add a column ALTER TABLE table_name ADD COLUMN column_name d...
Primary Keys & Foreign Keys
Primary Keys Natural Keys CREATE TABLE natural_key_example ( license_id text CONSTRAINT license...
JOIN and Set Operators
JOIN Types Type Description JOIN =INNER JOIN, returns rows from both tables where matching...
Basic Math and Stats with SQL
Median with percentile functions CREATE TABLE percentile_test ( numbers integer ); INSER...
Importing and Exporting Data
Import COPY COPY table_name FROM `/var/lib/postgres/data/spot_qt.csv' with (format csv, header) ...
Creating Table
Creating a Table create table spot_qt( year int, qt int, revenue numeric,...
Pandas Part V: Data Loading, Storage, and File Formats
Reading and Writing Data in Text Format Function Description read_csv csv read_clipboard...
matplotlib Part III: seaborn
seaborn import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot ...
Some bash commands I find useful
find . -type f -name "*.nfo" -o "*.edl" -delete find . -type f -name "*.nof" -o "*.edl" -exec mv...
matplotlib Cheat Sheet
figure class matplotlib.figure.Figure(figsize=None, dpi=None, *, facecolor=None, ...
numpy Cheat Sheet
random random.randn np.random.randn(d0, d1, ... , dn) randn returns a sample (or samples) from t...
pandas Cheat Sheet
pandas concat pandas.concat(objs, *, axis=0, join='outer', ignore_index=False, keys=None, levels=...
matplotlib Part I: Basics
Manipulating matplotlib import matplotlib as mpl mpl.rcParams['lines.linewidth'] = 3 mpl.rcParams...
matplotlib Part II: Bar Charts and Scatter Charts
Bar Charts labels = ['Physics', 'Chemistry', 'Literature', 'Peace'] foo_data = [3, 6, 10, 4] bar...
Cleaning Data with pandas
Reading Data df = pd.read_json('data/nobel_winners_dirty.json') df.info() <class 'pandas.core.fra...
Numpy, Pandas
Numpy # Moving Average def moving_average(arr, n=3): """ returns n-moving average(default=3) ar...
Moving Average
Simple Moving Average (SMA) SMA is the unweighted mean of the previous $k$ data-points.