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 numpy import arange | |
from scipy import stats | |
l=arange(0.1,1,0.1) | |
print l | |
import itertools as it | |
pr=it.product(l,repeat=6) | |
l2=list() | |
for i in pr: | |
l2.append(i) |
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 numpy import arange | |
from scipy import stats | |
l=arange(0.25,1.01,0.25)# l=arange(0.1,1,0.1) | |
print l | |
import itertools as it | |
pr=it.product(l,repeat=6) | |
l2=list(pr) | |
# for i in pr: | |
# l2.append(i) |
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 -*- | |
import xlrd | |
import csv | |
from os import sys | |
def csv_from_excel(excel_file): | |
workbook = xlrd.open_workbook(excel_file) | |
all_worksheets = workbook.sheet_names() | |
for worksheet_name in all_worksheets: | |
worksheet = workbook.sheet_by_name(worksheet_name) |
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
library(matrixStats) | |
library(R.methodsS3) | |
#biblioteki plyr uzyjemy do szybkiego wygenerowania podsumowan | |
library(plyr) | |
#do wykresow: | |
require(ggplot2) | |
#wyczyść wszystkie zmienne z pamięci | |
rm(list=ls(all=TRUE)) |
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
You do not even need lists if your "number" values are all of the same mode. If I take Dirk Eddelbuettel's example: | |
> foo <- c(12, 22, 33) | |
> names(foo) <- c("tic", "tac", "toe") | |
> foo | |
tic tac toe | |
12 22 33 | |
> names(foo) | |
[1] "tic" "tac" "toe" | |
Lists are only required if your values are either of mixed mode (for example characters and numbers) or vectors. |
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
> dat=read.csv(file.choose(),header=FALSE,sep=" ") | |
> head(dat) | |
V1 V2 V3 V4 | |
1 83965 891552 Identifiable People | |
2 88599 891552 Identifiable People | |
3 42966 891552 Identifiable People | |
4 83965 891553 Unidentifiable People | |
5 88599 891553 Unidentifiable People | |
6 42966 891553 Unidentifiable People | |
> dat$LABEL<-do.call(paste,c(dat[c("V3","V4")],sep="_")) |
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
dat<-dat[,!(names(dat) %in% c("V3","V4"))] |
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
import csv | |
from sets import Set | |
import sys | |
results = {} | |
items = Set()#[] | |
workers = Set()#[] | |
def addItem(idict): | |
#appending sets of workers and items | |
if int(idict['worker']) not in workers: | |
workers.add(int(idict['worker'])) |
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
tr '\t' '\n' <input >output |
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
import csv | |
from sets import Set | |
import sys | |
golds = {} | |
items = Set() | |
def loadData(path): | |
with open(path,'rU') as F: | |
csvdr = csv.DictReader(F,delimiter='\t') | |
for p in csvdr: | |
items.add(int(p['item'])) |