def testVar(self): t = [1, 1, 1, 3, 3, 591] mean = thinkstats2.Mean(t) var1 = thinkstats2.Var(t) var2 = thinkstats2.Var(t, mean) self.assertAlmostEqual(mean, 100.0) self.assertAlmostEqual(var1, 48217.0) self.assertAlmostEqual(var2, 48217.0)
def Process(table, name): """Runs various analyses on this table.""" first.Process(table) table.name = name table.var = thinkstats2.Var(table.lengths, table.mu) table.trim = thinkstats2.TrimmedMean(table.lengths) table.hist = Pmf.MakeHistFromList(table.lengths, name=name) table.pmf = Pmf.MakePmfFromHist(table.hist)