def testMultipleCalculationsRelativeTo(self):
data = pd.DataFrame({"X": (1, 2, 3, 10, 20, 30, 100, 200, 300),
"Y": (0, 1, 2, 3, 4, 5, 6, 7, 8),
"Experiment": ("Control", "Control", "Control", "Exp1",
"Exp1", "Exp1", "Exp2", "Exp2",
"Exp2")})
comparison = comparisons.AbsoluteDifference("Experiment", "Control")
output = core.Analyze(data).relative_to(comparison).calculate(
(metrics.Sum("X"), metrics.Sum("Y"))).run()
correct = pd.DataFrame(
{"sum(X) Absolute Difference": (60 - 6, 600 - 6),
"sum(Y) Absolute Difference": (12 - 3, 21 - 3)},
index=pd.Index(
("Exp1", "Exp2"), name="Experiment"))
self.assertTrue(output.equals(correct))
评论列表
文章目录