Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
using namespace std; | |
int main() | |
{ | |
// The user would introduce different values for divisor | |
int divisor = 3; | |
vector<int> numbers { 1, 2, 3, 4, 5, 10, 15, 20, 25, 35, 45, 50 }; |
// Here's my data model | |
function ViewModel(first, last) { | |
this.firstName = ko.observable(first); | |
this.lastName = ko.observable(last); | |
this.fullName = ko.computed(function() { | |
// Knockout tracks dependencies automatically. It knows that fullName depends on firstName and lastName, because these get called when evaluating fullName. | |
return this.firstName() + " " + this.lastName(); | |
}, this); | |
}; |
// Here's my data model | |
function ViewModel() { | |
//this.firstName = ko.observable(first); | |
//this.lastName = ko.observable(last); | |
this.firstName = "first"; | |
/* | |
this.fullName = ko.computed(function() { | |
// Knockout tracks dependencies automatically. It knows that fullName depends on firstName and lastName, because these get called when evaluating fullName. | |
return this.firstName() + " " + this.lastName(); | |
}, this); |
# load the package and data set "Teams" | |
install.packages("Lahman") | |
library("Lahman") | |
data(Teams) | |
# | |
# | |
# CREATE LEAGUE SUMMARY TABLES | |
# ============================ | |
# | |
# select a sub-set of teams from 1901 [the establishment of the American League] forward to 2012 |
PIMCO Quantitative Research
Steve Sapra, Ph.D., CFA and Manny Hunjan, CFA
October 2013
import sys | |
import json | |
def hw(): | |
print 'Hello, world!' | |
def lines(fp): | |
print str(len(fp.readlines())) | |
def main(): |
#include <iostream> | |
#include <chrono> | |
#include <random> | |
int main(int argc, char* argv []) | |
{ | |
auto x = 1; | |
std::cout << "auto variable x = " << x << std::endl; | |
srand(0u); |
# Step 1. | |
seaflow <- read.csv('seaflow_21min.csv', header=T) | |
summary(seaflow) | |
# Step 2. | |
# a <- sample(dim(seaflow)[1], dim(seaflow)[1]*0.8) | |
# trainseaflow <- seaflow[a,] | |
# b <- 1:dim(seaflow)[1] | |
# test.df <- seaflow[setdiff(b, a),] |
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
# C extensions | |
*.so | |
# Distribution / packaging | |
.Python | |
env/ |