Skip to content

Instantly share code, notes, and snippets.

View mikeyford's full-sized avatar

Mike Ford mikeyford

View GitHub Profile
import pandas as pd
import numpy as np
from sklearn.dummy import DummyClassifier
def load_data():
custs = pd.read_csv('customers.csv', # result of SELECT * FROM "default_server_production_events"."customers_data"
usecols=['registration_id',
'user_gender_cd',
### Keybase proof
I hereby claim:
* I am mikeyford on github.
* I am mikeyford (https://keybase.io/mikeyford) on keybase.
* I have a public key ASC83JzRo95xCh4Z6j2JMNY0oJ66RuFu6agsuF_3Ydwgmgo
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am mikeyford on github.
  • I am mikeyford (https://keybase.io/mikeyford) on keybase.
  • I have a public key ASBzbxnSaXQleyVzZYPiTbpnRuwNjVPaW38xGiKKr48S3Ao

To claim this, I am signing this object:

git reset --soft HEAD~17 (e.g. for n = 17)
git commit -m "squashed commits"
git push origin branch-name --force
@mikeyford
mikeyford / witan-api-upload.R
Created December 1, 2017 19:11
Example R script for uploading files to witanforcities.com via API
library(httr)
library(jsonlite)
library(tools)
library(iotools)
# Post for auth token
body <- list(username = "user.name@organisation.com", password = "ABCD1234") # update username and password
response <- POST("https://api.witanforcities.com/api/login", accept_json(), content_type_json(), body = body, encode = "json")
content <- fromJSON(readBin(response$content, character()))
@mikeyford
mikeyford / whichgame.py
Last active August 29, 2015 14:15
A script which returns a list of the most recent premier league games ordered by excitement and without spoilers.
import http.client
import json
import math
connection = http.client.HTTPConnection('api.football-data.org')
connection.request('GET', '/alpha/soccerseasons/354/fixtures') #An API token will needed as a header here for frequent use. See the rextester version below and the football-data sitefor more info.
data = json.loads(connection.getresponse().read().decode())
fixtures = (data["fixtures"])
matchday = False