This file contains 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
# coding: utf-8 | |
# In[70]: | |
import re | |
ssn_data = [ | |
["000115464","000135464"], # 4 | |
["763415464", "165415464"], #6 |
This file contains 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
local MAX_ACCOUNT_ID = 1 | |
function withdraw(self, v) | |
self.balance = self.balance - v | |
end | |
function deposit (self, v) | |
self.balance = self.balance + v | |
end |
This file contains 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
CSV = {} | |
function CSV:load (filename, headers) | |
headers = headers or false | |
-- if not headers then | |
file = io.open(filename, "r") -- "test.csv" | |
linecount = 0 | |
panel = {} | |
setmetatable(panel, self) |
This file contains 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 __future__ import division | |
import math | |
def future_value(V, R, n, m=1): | |
return V * (1+(R/m))**(n*m) | |
def present_value(FV, R, n): | |
return FV / ((1+R)**n) |
This file contains 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
0000000 000 0000000 | |
111111111 11111111100 000 111111111 | |
00000 111111111111111111 00000 000000 | |
000 1111111111111111111111111100000 000 | |
000 1111 1111111111111111100 000 | |
000 11 0 1111111100 000 | |
000 1 00 1 000 | |
000 00 00 1 000 | |
000 000 00000 1 000 | |
00000 0000 00000000 1 00000 |
This file contains 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
package main | |
import ( | |
"container/ring" | |
"fmt" | |
"os" | |
"time" | |
) | |
func main() { |
This file contains 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
package main | |
import "fmt" | |
func main() { | |
a := A{} | |
a.N = "hello" | |
fmt.Println(a.Method.O("world")) | |
fmt.Println(a.Method.I("whatup!")) | |
fmt.Println(a.Method.F("wtf?")) |
This file contains 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
# coding: utf-8 | |
# In[39]: | |
import re | |
import pymysql | |
import pandas as pd | |
original_headers = """NPI","Entity Type Code","Replacement NPI","Employer Identification Number (EIN)","Provider Organization Name (Legal Business Name)","Provider Last Name (Legal Name)","Provider First Name","Provider Middle Name","Provider Name Prefix Text","Provider Name Suffix Text","Provider Credential Text","Provider Other Organization Name","Provider Other Organization Name Type Code","Provider Other Last Name","Provider Other First Name","Provider Other Middle Name","Provider Other Name Prefix Text","Provider Other Name Suffix Text","Provider Other Credential Text","Provider Other Last Name Type Code","Provider First Line Business Mailing Address","Provider Second Line Business Mailing Address","Provider Business Mailing Address City Name","Provider Business Mailing Address State Name","Provider Business Mailing Address Postal Code","Provider Business Mailing Address Country Code (If outside U.S.)","Provider Business Mailing A |
This file contains 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
# http://machinelearningmastery.com/naive-bayes-classifier-scratch-python/ | |
import pandas as pd | |
import random | |
pima = pd.read_csv("https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data", header=None) | |
pima.columns = [ | |
"num_pregnant", | |
"plasma_glucose", | |
"diastolic_bp", |
This file contains 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
def fac(n): | |
return int(n * fac(n-1)) if (n-1) > 0 else n | |
def perm(n,r): # n! / (n-r)! | |
return int(fac(n) / fac(n-r)) | |
def comb(n,r): # n! / r!(n-r)! | |
return int(fac(n) / (fac(r)*fac(n-r))) |