def testSimplePivot(self): ts = self.getts(cols = 4) b = BasicStatistics(ts) p = pivottable(b.calculate()) d = p.defaultname self.assertEqual(len(p.names),ts.count()) for field in p.fields: self.assertEqual(p.get(field),p.get(field,d))
def testRangeFunction(self): ts = self.getts(cols = 4) b = BasicStatistics(ts) p = pivottable(b.calculate()) range = p.get('range') min = p.get('min') max = p.get('max') self.assertEqual(range,[min,max])
def __testFunctions(self): '''Not working yet''' ts = self.getts(cols=4) b = BasicStatistics(ts, functions=['min', 'max', 'mean', 'zscore']) d = b.calculate() self.assertEqual(len(d), 6) p = pivottable(d) self.assertEqual(len(p.fields), 5)
def testRangeFunction(self): ts = self.getts(cols=4) b = BasicStatistics(ts) p = pivottable(b.calculate()) range = p.get('range') min = p.get('min') max = p.get('max') self.assertEqual(range, [min, max])
def testSimplePivot(self): ts = self.getts(cols=4) b = BasicStatistics(ts) p = pivottable(b.calculate()) d = p.defaultname self.assertEqual(len(p.names), ts.count()) for field in p.fields: self.assertEqual(p.get(field), p.get(field, d))
def __testFunctions(self): '''Not working yet''' ts = self.getts(cols = 4) b = BasicStatistics(ts, functions=['min','max','mean','zscore']) d = b.calculate() self.assertEqual(len(d),6) p = pivottable(d) self.assertEqual(len(p.fields),5)
def testPrangeFunction(self): ts = self.getts(cols = 4) b = BasicStatistics(ts) p = pivottable(b.calculate()) range = p.get('prange') min = p.get('min') max = p.get('max') lat = p.get('latest') self.assertEqual(range,100.*(lat-min)/(max-min))
def testFullPivot(self): ts = self.getts(cols = 4) b = BasicStatistics(ts) p = pivottable(b.calculate()) for field in p.fields: for name in p.names: val = p.get(field,name) dt = dict(zip(p.data['names'],p.data[field])) self.assertEqual(val,dt[name])
def testPrangeFunction(self): ts = self.getts(cols=4) b = BasicStatistics(ts) p = pivottable(b.calculate()) range = p.get('prange') min = p.get('min') max = p.get('max') lat = p.get('latest') self.assertEqual(range, 100. * (lat - min) / (max - min))
def testFullPivot(self): ts = self.getts(cols=4) b = BasicStatistics(ts) p = pivottable(b.calculate()) for field in p.fields: for name in p.names: val = p.get(field, name) dt = dict(zip(p.data['names'], p.data[field])) self.assertEqual(val, dt[name])