def test_summary_mean(pyspark, summarizers, tests_utils, price, forecast): expected_pdf = make_pdf([( 0, 3.25, )], ["time", "price_mean"]) joined = price.leftJoin(forecast, key="id") result = joined.summarize(summarizers.mean("price")).toPandas() pdt.assert_frame_equal(result, expected_pdf)
def test_summary_mean(self): from ts.flint import summarizers price = self.price() forecast = self.forecast() expected_pdf = test_utils.make_pdf([( 0, 3.25, )], ["time", "price_mean"]) joined = price.leftJoin(forecast, key="id") result = joined.summarize(summarizers.mean("price")).toPandas() pdt.assert_frame_equal(result, expected_pdf)
def test_summary_mean(self): from ts.flint import summarizers price = self.price() forecast = self.forecast() expected_pdf = make_pdf([ (0, 3.25,) ], ["time", "price_mean"]) joined = price.leftJoin(forecast, key="id") result = joined.summarize(summarizers.mean("price")).toPandas() pdt.assert_frame_equal(result, expected_pdf)
def test_summary_compose(self): from ts.flint import summarizers price = self.price() expected_pdf = make_pdf([ (0, 6.0, 0.5, 3.25, 1.802775638,) ], ["time", "price_max", "price_min", "price_mean", "price_stddev"]) result = price.summarize([summarizers.max("price"), summarizers.min("price"), summarizers.mean("price"), summarizers.stddev("price")]).toPandas() pdt.assert_frame_equal(result, expected_pdf)
def test_summary_compose(pyspark, summarizers, tests_utils, price): expected_pdf = make_pdf([( 0, 6.0, 0.5, 3.25, 1.802775638, )], ["time", "price_max", "price_min", "price_mean", "price_stddev"]) result = price.summarize([ summarizers.max("price"), summarizers.min("price"), summarizers.mean("price"), summarizers.stddev("price") ]).toPandas() pdt.assert_frame_equal(result, expected_pdf)
def test_summary_compose(self): from ts.flint import summarizers price = self.price() expected_pdf = test_utils.make_pdf([( 0, 6.0, 0.5, 3.25, 1.802775638, )], ["time", "price_max", "price_min", "price_mean", "price_stddev"]) result = price.summarize([ summarizers.max("price"), summarizers.min("price"), summarizers.mean("price"), summarizers.stddev("price") ]).toPandas() pdt.assert_frame_equal(result, expected_pdf)