def test_memoize_aggregate_correctly(self): table = self.table agg_expr = (table['c'].sum() / table['c'].mean() - 1).name('analysis') agg_exprs = [table['a'].sum().name('sum(a)'), table['b'].mean().name('mean(b)'), agg_expr] result = table.aggregate(agg_exprs, by=['g']) formatter = ExprFormatter(result) formatted = formatter.get_result() alias = formatter.memo.get_alias(table.op()) assert formatted.count(alias) == 7
def test_memoize_aggregate_correctly(self): table = self.table agg_expr = (table['c'].sum() / table['c'].mean() - 1).name('analysis') agg_exprs = [table['a'].sum().name('sum(a)'), table['b'].mean().name('mean(b)'), agg_expr] result = table.aggregate(agg_exprs, by=['g']) formatter = ExprFormatter(result) formatted = formatter.get_result() alias = formatter.memo.get_alias(table) assert formatted.count(alias) == 7
def test_memoize_aggregate_correctly(table): agg_expr = (table['c'].sum() / table['c'].mean() - 1).name('analysis') metrics = [ table['a'].sum().name('sum(a)'), table['b'].mean().name('mean(b)'), agg_expr, ] result = table.aggregate(metrics, by=['g']) formatter = ExprFormatter(result) formatted = formatter.get_result() alias = formatter.memo.get_alias(table) assert formatted.count(alias) == 7
def _repr(self, memo=None): from ibis.expr.format import ExprFormatter return ExprFormatter(self, memo=memo).get_result()
def _repr(self, memo: FormatMemo | None = None) -> str: from ibis.expr.format import ExprFormatter return ExprFormatter(self, memo=memo).get_result()
def _repr(self): from ibis.expr.format import ExprFormatter return ExprFormatter(self).get_result()
def _repr(self, memo: 'Optional[FormatMemo]' = None): from ibis.expr.format import ExprFormatter return ExprFormatter(self, memo=memo).get_result()