def getMixedTypeDict(): index = Index(['a', 'b', 'c', 'd', 'e']) data = { 'A' : [0., 1., 2., 3., 4.], 'B' : [0., 1., 0., 1., 0.], 'C' : ['foo1', 'foo2', 'foo3', 'foo4', 'foo5'], 'D' : DateRange('1/1/2009', periods=5) } return index, data
def setUp(self): arr = randn(N) arr[self._nan_locs] = np.NaN self.arr = arr self.rng = DateRange(datetime(2009, 1, 1), periods=N) self.series = Series(arr.copy(), index=self.rng) self.frame = DataFrame(randn(N, K), index=self.rng, columns=np.arange(K))
def setUp(self): date_index = DateRange(datetime(2009, 12, 11), periods=3, offset=bday) ts = Series([3, 1, 4], index=date_index) self.TS1 = ts date_index = DateRange(datetime(2009, 12, 11), periods=5, offset=bday) ts = Series([1, 5, 9, 2, 6], index=date_index) self.TS2 = ts date_index = DateRange(datetime(2009, 12, 11), periods=3, offset=bday) ts = Series([5, NaN, 3], index=date_index) self.TS3 = ts date_index = DateRange(datetime(2009, 12, 11), periods=5, offset=bday) ts = Series([NaN, 5, 8, 9, 7], index=date_index) self.TS4 = ts data = {'x1': self.TS2, 'x2': self.TS4} self.DF1 = DataFrame(data=data) data = {'x1': self.TS2, 'x2': self.TS4} self.DICT1 = data
def makeDateIndex(k): dates = list(DateRange(datetime(2000, 1, 1), periods=k)) return Index(dates)
from datetime import datetime import string import numpy as np from pandas.core.api import Series, DataFrame, DateRange from pandas.stats.api import ols N = 100 start = datetime(2009, 9, 2) dateRange = DateRange(start, periods=N) def makeDataFrame(): data = DataFrame(np.random.randn(N, 7), columns=list(string.ascii_uppercase[:7]), index=dateRange) return data def makeSeries(): return Series(np.random.randn(N), index=dateRange) #------------------------------------------------------------------------------- # Standard rolling linear regression X = makeDataFrame() Y = makeSeries()
# pylint: disable-msg=W0611,W0402 from datetime import datetime import string import unittest import nose import numpy as np from pandas.core.api import DataFrame, DateRange from pandas.util.testing import assert_almost_equal # imported in other tests N = 100 K = 4 start = datetime(2007, 1, 1) DATE_RANGE = DateRange(start, periods=N) COLS = ['Col' + c for c in string.ascii_uppercase[:K]] def makeDataFrame(): data = DataFrame(np.random.randn(N, K), columns=COLS, index=DATE_RANGE) return data def getBasicDatasets(): A = makeDataFrame() B = makeDataFrame() C = makeDataFrame()