Skip to content

Instantly share code, notes, and snippets.

Avatar

Peadar Coyle springcoil

View GitHub Profile
@springcoil
springcoil / MongoDB_Experiment_IPython
Created May 21, 2014
IPython Notebook - for MongoDB
View MongoDB_Experiment_IPython
{
"metadata": {
"name": "",
"signature": "sha256:2c5a94596837b925899f0aab294f5a5d31a0c6227abf97c00b871ecbe116bcdf"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@springcoil
springcoil / Postgres_Fun
Created Jun 18, 2014
CSVKit and PostgreSQL
View Postgres_Fun
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"
View pandas_dbms.py
# -*- 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 Aug 19, 2014
Coursera UW: Introduction to Data Science
View datascienceRscript
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 Aug 19, 2014
Coursera UW: Introduction to Data Science
View datascienceRscript
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")
View installpythonframeworks.sh
#!/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 &&
View Updated_Six_Nations_Model
{
"metadata": {
"name": "",
"signature": "sha256:9c901b87c21a76e998af9a7e0bf41fad4ba1df839faeac70481cbcb4124e7289"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@springcoil
springcoil / Sixnationsmodel
Last active Aug 29, 2015
SixNationsModel
View Sixnationsmodel
{
"metadata": {
"name": "",
"signature": "sha256:50c3d72f03b2ec97ee24d9e5a4f27faa1a48d7fe209616e378edc70f146f845b"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
View report-runner.py
# -*- 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 Aug 29, 2015
A Bayesian model for myself to debug - PyData Berlin
View Bayesian_Model.py
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')