示例#1
0
文件: test.py 项目: dhesse/pdc
 def test_mean_add(self):
     x = scipy.random.randint(0, 10, 100)
     twox = x * 2
     df = DataFrame(x=x, tx=2 * x)
     glob = df.scope
     s = df.group_by('tx').summarize(txo=mean(glob['x'] + glob['x']))
     self.assertAllClose(s.txo, s.tx)
示例#2
0
文件: test.py 项目: dhesse/pdc
 def test_mean(self):
     df = DataFrame(x=scipy.random.randint(0, 10, 100))
     s = df.group_by('x').summarize(mu=mean('x'))
     self.assertAllClose(s.x, s.mu)
示例#3
0
文件: test.py 项目: dhesse/pdc
 def test_sd(self):
     df = DataFrame(x=scipy.random.randint(0, 10, 100))
     s = df.group_by('x').summarize(sd=sd('x'))
     self.assertAllClose(0, s.sd)
示例#4
0
文件: test.py 项目: dhesse/pdc
 def test_sum_n(self):
     a = DataFrame(globals(),
                   x=scipy.random.randint(0, 10, 100),
                   y=scipy.random.randint(0, 10, 100))
     s = a.group_by(x, y).summarize(n=n())
     self.assertEqual(s.n.sum(), 100)