Skip to content

Instantly share code, notes, and snippets.

@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active May 22, 2025 23:58
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

@springcoil
springcoil / ETL_python.md
Last active October 26, 2015 18:42
What data pipelines are there in python?

I want to do ETL and I want to do it in python. What tools do I have access to?

@bstancil
bstancil / Finding User Sessions with SQL
Last active October 18, 2023 16:07
These queries let you define find user sessions against event data logged to Segment SQL, Snowplow, or Google BigQuery.
-- These queries let you define find user sessions against event data
-- logged to Segment SQL, Snowplow, or Google BigQuery.
-- For more details, see the full post:
-- LINK
--- SEGMENT SQL
-- Finding the start of every session
SELECT *
FROM (
@sckott
sckott / elastic_dsl.md
Last active August 29, 2015 14:15
elastic DSL - example

Working on a DSL for the elastic package. Get latest, install from dsl branch

install

install.packages("devtools")
devtools::install_github("ropensci/elastic", ref="dsl")
@igorbrigadir
igorbrigadir / 2010
Last active August 29, 2015 14:15
National Security Strategy Archive
Overview of National Security StrategyAt the dawn of the 21st century, the United States of America faces a broad and complex array of chal-lenges to our national security. Just as America helped to determine the course of the 20th century, we must now build the sources of American strength and influence, and shape an international order capable of overcoming the challenges of the 21st century.
The World as It Is, A Strategy for the World We Seek To succeed, we must face the world as it is. The two decades since the end of the Cold War have been marked by both the promise and perils of change. The circle of peaceful democracies has expanded; the specter of nuclear war has lifted; major powers are at peace; the global economy has grown; commerce has stitched the fate of nations together; and more individuals can determine their own destiny. Yet these advances have been accompanied by persistent problems. Wars over ideology have given way to wars over religious, ethnic, and tribal identity; nuclear dangers hav
@mblondel
mblondel / nmf_cd.py
Last active June 12, 2019 20:00
NMF by coordinate descent
"""
NMF by coordinate descent, designed for sparse data (without missing values)
"""
# Author: Mathieu Blondel <[email protected]>
# License: BSD 3 clause
import numpy as np
import scipy.sparse as sp
import numba
@elliottcordo
elliottcordo / gist:59d3c90b158331fe6ed7
Created August 13, 2014 20:21
python-redshift-pandas-statistics
import sys
import logging
import psycopg2
import pandas as pd
import pandas.io.sql as sqlio
import ConfigParser
import argparse
import statistics
from pandas import pivot_table, crosstab
from datetime import datetime
@syhw
syhw / dnn.py
Last active October 19, 2024 08:20
A simple deep neural network with or w/o dropout in one file.
"""
A deep neural network with or w/o dropout in one file.
License: Do What The Fuck You Want to Public License http://www.wtfpl.net/
"""
import numpy, theano, sys, math
from theano import tensor as T
from theano import shared
from theano.tensor.shared_randomstreams import RandomStreams
@bsweger
bsweger / useful_pandas_snippets.md
Last active June 14, 2025 19:01
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@okomestudio
okomestudio / ab_test.py
Created May 12, 2014 19:19
An example of A/B test using the chi-squared test for independence.
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""An example of A/B test using the chi-squared test for independence."""
import numpy as np
import pandas as pd
from scipy.stats import chi2_contingency
def main():
data = pd.io.parsers.read_csv('n10000.csv')