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
data = [] | |
for d in range(d): | |
temp = df.ix[:, ['event_id', 'obj_%d_id' % d, 'obj_%d_foo' % d, 'obj_%d_bar' % d]] | |
data.append(temp) |
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
# https://github.com/dalejung/trtools/blob/master/trtools/rpy/conversion.py | |
import sys, copy, os, itertools | |
import rpy2.robjects as robjects | |
import rpy2.rinterface as rinterface | |
from rpy2.robjects.vectors import SexpVector, ListVector | |
from rpy2.robjects.robject import RObjectMixin, RObject | |
import rpy2.robjects as robj | |
import numpy as np | |
import pandas.rpy.common as rcom |
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
# If your data.frame index is unordered and you only have one column. This portion of xts will error. | |
if(!is.null(x) && !isOrdered(order.by, strictly=!unique) ) { | |
indx <- order(order.by) | |
if(NCOL(x) > 1 || is.matrix(x)) { | |
x <- x[indx,] | |
} else x <- x[indx] | |
order.by <- order.by[indx] | |
} |
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
# Create a uniform date range. | |
times = format(as.POSIXct('2002-04-07', tz='GMT') + seq(1, by=1800, length.out=48)) | |
rdf = data.frame(bob=1:48) | |
rownames(rdf) = times | |
as.xts(rdf) | |
# Error in `[.data.frame`(x, indx) : undefined columns selected |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 pandas as pd |
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.
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
utc_time <- as.POSIXlt(c("2012-08-12 23:55:00","2012-08-13 00:05:00"), tz="UTC") | |
utc_weeks <- endpoints(utc_time, "weeks") | |
# [1] 0 1 2 | |
est_time <- as.POSIXlt(c("2012-08-12 23:55:00","2012-08-13 00:05:00"), tz="US/Eastern") | |
est_weeks <- endpoints(est_time, "weeks") | |
# [1] 0 2 |
OlderNewer