This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import boto3 | |
import argparse | |
from datetime import datetime | |
parser = argparse.ArgumentParser() | |
parser.add_argument("job_id") | |
# Add the arguments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
'''To use gzip file between python application and S3 directly for Python3. | |
Python 2 version - https://gist.github.com/a-hisame/f90815f4fae695ad3f16cb48a81ec06e | |
''' | |
import io | |
import gzip | |
import json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import traceback | |
import logging | |
import facebook | |
import requests | |
import pandas as pd | |
import json | |
import time | |
import numpy as np | |
from pandas.io.json import json_normalize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from numpy import random | |
from sklearn import base | |
class PUWrapper(object): | |
def __init__(self,trad_clf,n_fold=5): | |
self._trad_clf=trad_clf | |
self._n_fold=n_fold | |
def fit(self,X,s): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Speed tests of different ways to read in large numbers of CSV files | |
# specifically read.csv.sql, read.csv (optimised) and fread | |
library(sqldf) | |
setwd("~/Downloads/wordcounts") | |
files <- sample(list.files(".", pattern="*.csv|CSV$"), 10000) | |
############# read.csv.sql ################### | |
system.time( |