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 scipy import stats | |
differences = [B[i] - A[i] for i in range(len(A))] | |
# one sample t-test | |
stats.ttest_1samp(differences, popmean=0) | |
# assess the equality of variances | |
stats.levene(A, B) |
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 operator | |
x = {1: 2, 3: 4, 4: 3, 2: 1, 0: 0} | |
sorted_x = sorted(x.items(), key=operator.itemgetter(1)) |
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
from collections import namedtuple | |
Animal = namedtuple('Animal', 'name age type') | |
big_yellow = Animal(name="big_yellow", age=3, type="dog") |
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 datetime | |
def date_range(start_date, end_date): | |
start = datetime.datetime.strptime(start_date, "%Y-%m-%d") | |
end = datetime.datetime.strptime(end_date, "%Y-%m-%d") | |
return [start + datetime.timedelta(days=x) for x in range(0, (end-start).days)] |
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 tensorflow as tf | |
sess = tf.Session() | |
writer = tf.summary.FileWriter('./my_graph', sess.graph) |
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
from nose.tools import * | |
def test_ |
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
%matplotlib inline | |
import numpy as np | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
import seaborn as sns |
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 time | |
start = time.time() | |
end = time.time() | |
elapsed = end - start | |
print "Time taken: ", elapsed, "seconds." |
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
from openpyxl.workbook import Workbook | |
from openpyxl.writer.excel import ExcelWriter | |
from openpyxl.cell import get_column_letter | |
class XlsLogger(object): | |
""" | |
Save something to a Excel spreadsheet | |
""" | |
def __init__(self): |
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 python | |
# -*- coding: UTF-8 -*- | |
import unittest | |
class simpleTest(unittest.TestCase): | |
def setUp(self): | |
pass | |
def tearDown(self): |
NewerOlder