The following formula adds this quality start projection formula to the Steamer projections export from Fangraphs.
=IF(E2 > 0, ROUND((((I2/E2)/6.15)-(0.11*D2))*E2, 0), 0)
NB: This expects that you're tacking the column onto the end of the row.
cd ~ | |
sudo apt-get update | |
sudo apt-get install openjdk-7-jre -y | |
wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.5.tar.gz -O elasticsearch.tar.gz | |
tar -xf elasticsearch.tar.gz | |
rm elasticsearch.tar.gz | |
sudo mv elasticsearch-* elasticsearch | |
sudo mv elasticsearch /opt | |
chown matt:matt -R /opt/elasticsearch |
The following formula adds this quality start projection formula to the Steamer projections export from Fangraphs.
=IF(E2 > 0, ROUND((((I2/E2)/6.15)-(0.11*D2))*E2, 0), 0)
NB: This expects that you're tacking the column onto the end of the row.
import csv | |
import glob | |
import os | |
import sys | |
from mattreduce import Job | |
get_state = lambda outs, bases: '%s:%s' % (outs, bases) |
#!/usr/bin/env python | |
import sys | |
last = '' | |
punc = ',' | |
while True: | |
c = sys.stdin.read(1) | |
if c: |
import datetime | |
import dateutil.tz | |
import pytz | |
def get_formatted_tz(zone): | |
"""Returns +/-HH:MM formatted time zone offset. |
from django.db.models import signals | |
from haystack.indexes import RealTimeSearchIndex | |
class ManyAwareRealTimeSearchIndex(RealTimeSearchIndex): | |
"""Many-to-many aware real-time search index base class | |
""" | |
def _on_m2m_changed(self, instance, using=None, **kwargs): |
from bson.code import Code | |
import pymongo | |
connection = pymongo.connection.Connection() | |
db = connection['retrosheet'] | |
tbl = db['events_2010'] | |
# limit results to complete plate appearances. |
function(key, result) { | |
return ((0.72 * result.nibb) + (0.75 * result.hbp) + (0.9 * result._1b) + (0.92 * result.rboe) + | |
(1.24 * result._2b) + (1.56 * result._3b) + (1.95 * result.hr)) / result.pa; | |
} |
function(key, values) { | |
var result = {nibb: 0, hbp: 0, _1b: 0, _2b: 0, _3b: 0, hr: 0, rboe: 0, pa: 0}; | |
for(var i in values) { | |
result.nibb += values[i].nibb; | |
result.hbp += values[i].hbp; | |
result._1b += values[i]._1b; | |
result._2b += values[i]._2b; | |
result._3b += values[i]._3b; | |
result.hr += values[i].hr; |
function() { | |
var woba_fields = {nibb: (this.EVENT_CD == '14') ? 1 : 0, | |
hbp: (this.EVENT_CD == '15') ? 1 : 0, | |
_1b: (this.EVENT_CD == '20') ? 1 : 0, | |
_2b: (this.EVENT_CD == '21') ? 1 : 0, | |
_3b: (this.EVENT_CD == '22') ? 1 : 0, | |
hr: (this.EVENT_CD == '23') ? 1 : 0, | |
rboe: (this.BAT_SAFE_ERR_FL == 'T') ? 1 : 0, | |
pa: 1}; | |
emit(this.BAT_ID, woba_fields); |