Skip to content

Instantly share code, notes, and snippets.

View springcoil's full-sized avatar

Peadar Coyle springcoil

View GitHub Profile
@springcoil
springcoil / MongoDB_Experiment_IPython
Created May 21, 2014 14:19
IPython Notebook - for MongoDB
{
"metadata": {
"name": "",
"signature": "sha256:2c5a94596837b925899f0aab294f5a5d31a0c6227abf97c00b871ecbe116bcdf"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@springcoil
springcoil / Postgres_Fun
Created June 18, 2014 12:03
CSVKit and PostgreSQL
csvsql --db postgresql:///test1 --insert Problem_Set_Operations_Research.csv
# I was having some trouble getting a csv file inserted into a Postgres Database. The above line worked.
\dt
#Shows the tables in a particular database
\connect test1
#Connects to a database with a particular name in the case above "test1"
# -*- coding: utf-8 -*-
"""
LICENSE: BSD (same as pandas)
example use of pandas with oracle mysql postgresql sqlite
- updated 9/18/2012 with better column name handling; couple of bug fixes.
- used ~20 times for various ETL jobs. Mostly MySQL, but some Oracle.
to do:
save/restore index (how to check table existence? just do select count(*)?),
finish odbc,
@springcoil
springcoil / datascienceRscript
Created August 19, 2014 11:55
Coursera UW: Introduction to Data Science
install.packages("caret")
install.packages("rpart")
install.packages("tree")
install.packages("randomForest")
install.packages("e1071")
install.packages("ggplot2")
table <- read.csv("DataSciIntro/assignment5//seaflow_21min.csv")
library("caret")
library("rpart")
@springcoil
springcoil / datascienceRscript
Created August 19, 2014 11:56
Coursera UW: Introduction to Data Science
install.packages("caret")
install.packages("rpart")
install.packages("tree")
install.packages("randomForest")
install.packages("e1071")
install.packages("ggplot2")
table <- read.csv("DataSciIntro/assignment5//seaflow_21min.csv")
library("caret")
library("rpart")
@springcoil
springcoil / installpythonframeworks.sh
Created September 12, 2014 11:44
pip install matplotlib
#!/bin/bash
virtualenv .env &&
source .env/bin/activate &&
sudo apt-get install -y libevent-dev &&
sudo apt-get install -y libyaml-0-2 &&
sudo apt-get install --yes --force-yes automake autoconf libtool* gfortran &&
sudo apt-get install --yes --force-yes liblapack-dev &&
sudo apt-get install --yes --force-yes binutils &&
sudo apt-get install -y libatlas-dev &&
sudo apt-get install -y build-essential --upgrade &&
@springcoil
springcoil / Sixnationsmodel
Last active August 29, 2015 14:15
SixNationsModel
{
"metadata": {
"name": "",
"signature": "sha256:50c3d72f03b2ec97ee24d9e5a4f27faa1a48d7fe209616e378edc70f146f845b"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@springcoil
springcoil / Updated_Six_Nations_Model
Created February 8, 2015 15:17
Updated_Six_Nations_Model
{
"metadata": {
"name": "",
"signature": "sha256:9c901b87c21a76e998af9a7e0bf41fad4ba1df839faeac70481cbcb4124e7289"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
# -*- coding: utf-8 -*-
"""
Sample report generation script from pbpython.com
This program takes an input Excel file, reads it and turns it into a
pivot table.
The output is saved in multiple tabs in a new Excel file.
"""
@springcoil
springcoil / Bayesian_Model.py
Last active August 29, 2015 14:21
A Bayesian model for myself to debug - PyData Berlin
g = simuls.groupby('Team')
season_hdis = pd.DataFrame({'points_lower': g.points.quantile(.05),
'points_upper': g.points.quantile(.95),
'goals_for_lower': g.gf.quantile(.05),
'goals_for_median': g.gf.median(),
'goals_for_upper': g.gf.quantile(.95),
'goals_against_lower': g.ga.quantile(.05),
'goals_against_upper': g.ga.quantile(.95),
})
season_hdis = pd.merge(season_hdis, df_observed, left_index=True, right_on='Team')