ibis.expr.api.GroupedTableExpr.mutate¶
-
GroupedTableExpr.
mutate
(exprs=None, **kwds)¶ Returns a table projection with analytic / window functions applied. Any arguments can be functions.
- Parameters
exprs (list, default None) –
kwds (key=value pairs) –
Examples
>>> import ibis >>> t = ibis.table([ ... ('foo', 'string'), ... ('bar', 'string'), ... ('baz', 'double'), ... ], name='t') >>> t UnboundTable[table] name: t schema: foo : string bar : string baz : float64 >>> expr = (t.group_by('foo') ... .order_by(ibis.desc('bar')) ... .mutate(qux=lambda x: x.baz.lag(), ... qux2=t.baz.lead())) >>> print(expr) ref_0 UnboundTable[table] name: t schema: foo : string bar : string baz : float64 Selection[table] table: Table: ref_0 selections: Table: ref_0 qux = WindowOp[float64*] qux = Lag[float64*] baz = Column[float64*] 'baz' from table ref_0 offset: None default: None <ibis.expr.window.Window object at 0x...> qux2 = WindowOp[float64*] qux2 = Lead[float64*] baz = Column[float64*] 'baz' from table ref_0 offset: None default: None <ibis.expr.window.Window object at 0x...>
- Returns
mutated
- Return type
TableExpr