Skip to content

Instantly share code, notes, and snippets.

@araastat
araastat / tocsv.py
Created March 5, 2014 13:06
Export each sheet of a xls/xlsx file to csv
import pandas as pd
import xlrd as xd
def xls2csv(f, index=False, header=True):
wb = xd.open_workbook(f)
snames=[]
for s in wb.sheets():
snames.append(s.name)
for s in snames:
x = pd.read_excel(f,s)
# This file contains two functions:
# - combine.samples (used by par.trace.samples)
# - par.trace.samples
# and an example at the bottom.
## Author: Mikhail Popov (mikhail [at] mpopov.com)
# install.packages("rjags") # JAGS must be installed on system
# install.packages("doMC") # Unix only
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
setwd('~/Downloads')
dat <- read.csv('VennDiagrams2-data.csv', stringsAsFactors=F)
for(u in c('visited','joined')){
dat[[u]] <- as.Date(dat[[u]])
}
library(plyr)
library(reshape2)
library(chron)
dat$monthly = paste(months(as.chron(dat$visited)), years(as.chron(dat$visited)))
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@araastat
araastat / leuk.py
Created November 22, 2013 18:25 — forked from fonnesbeck/leuk.ipynb
{
"metadata": {
"name": "Survival Example"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.